summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-30 17:10:03 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-03-30 17:10:03 +0000
commit56f8c49f065831c21156dd88bd5397b6ba355813 (patch)
treeb667b75966806a271eeee6ac72e42a7aacfeb0bd /src/map
parentc883ca205971275e576d34b54304c3c5c30f3580 (diff)
downloadhercules-56f8c49f065831c21156dd88bd5397b6ba355813.tar.gz
hercules-56f8c49f065831c21156dd88bd5397b6ba355813.tar.bz2
hercules-56f8c49f065831c21156dd88bd5397b6ba355813.tar.xz
hercules-56f8c49f065831c21156dd88bd5397b6ba355813.zip
* Added base code for loading Ser's UPNP plugin
* Added 'idle_no_share' to battle_athena.conf * Added item_findingore.txt git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1343 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c2
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/itemdb.c16
-rw-r--r--src/map/mob.c5
-rw-r--r--src/map/party.c26
-rw-r--r--src/map/skill.c54
6 files changed, 52 insertions, 52 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index aa30ef0a9..421f85ec3 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -4202,6 +4202,7 @@ static const struct {
{ "exp_calc_type", &battle_config.exp_calc_type}, // [celest]
{ "min_skill_delay_limit", &battle_config.min_skill_delay_limit}, // [celest]
{ "require_glory_guild", &battle_config.require_glory_guild}, // [celest]
+ { "idle_no_share", &battle_config.idle_no_share}, // [celest], for a feature by [MouseJstr]
//SQL-only options start
#ifndef TXT_ONLY
@@ -4450,6 +4451,7 @@ void battle_set_defaults() {
battle_config.exp_calc_type = 1;
battle_config.min_skill_delay_limit = 100;
battle_config.require_glory_guild = 0;
+ battle_config.idle_no_share = 0;
//SQL-only options start
#ifndef TXT_ONLY
diff --git a/src/map/battle.h b/src/map/battle.h
index 3bb9068bf..393cc58b4 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -312,6 +312,7 @@ extern struct Battle_Config {
int exp_calc_type;
int min_skill_delay_limit;
int require_glory_guild;
+ int idle_no_share;
#ifndef TXT_ONLY /* SQL-only options */
int mail_system; // [Valaris]
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index d575e8a77..91ec58c81 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -26,9 +26,9 @@
static struct dbt* item_db;
-static struct random_item_data blue_box[MAX_RANDITEM],violet_box[MAX_RANDITEM],card_album[MAX_RANDITEM],gift_box[MAX_RANDITEM],scroll[MAX_RANDITEM];
-static int blue_box_count=0,violet_box_count=0,card_album_count=0,gift_box_count=0,scroll_count=0;
-static int blue_box_default=0,violet_box_default=0,card_album_default=0,gift_box_default=0,scroll_default=0;
+static struct random_item_data blue_box[MAX_RANDITEM], violet_box[MAX_RANDITEM], card_album[MAX_RANDITEM], gift_box[MAX_RANDITEM], scroll[MAX_RANDITEM], finding_ore[MAX_RANDITEM];
+static int blue_box_count=0, violet_box_count=0, card_album_count=0, gift_box_count=0, scroll_count=0, finding_ore_count = 0;
+static int blue_box_default=0, violet_box_default=0, card_album_default=0, gift_box_default=0, scroll_default=0, finding_ore_default = 0;
// Function declarations
@@ -102,7 +102,7 @@ int itemdb_searchrandomid(int flags)
struct {
int nameid,count;
struct random_item_data *list;
- } data[6];
+ } data[7];
// for BCC32 compile error
data[0].nameid = 0; data[0].count = 0; data[0].list = NULL;
@@ -111,8 +111,9 @@ int itemdb_searchrandomid(int flags)
data[3].nameid = card_album_default; data[3].count = card_album_count; data[3].list = card_album;
data[4].nameid = gift_box_default; data[4].count = gift_box_count; data[4].list = gift_box;
data[5].nameid = scroll_default; data[5].count = scroll_count; data[5].list = scroll;
+ data[6].nameid = finding_ore_default; data[6].count = finding_ore_count; data[6].list = finding_ore;
- if(flags>=1 && flags<=5){
+ if(flags>=1 && flags<=6){
nameid=data[flags].nameid;
count=data[flags].count;
list=data[flags].list;
@@ -410,8 +411,9 @@ static int itemdb_read_randomitem()
{"db/item_bluebox.txt", blue_box, &blue_box_count, &blue_box_default },
{"db/item_violetbox.txt", violet_box, &violet_box_count, &violet_box_default },
{"db/item_cardalbum.txt", card_album, &card_album_count, &card_album_default },
- {"db/item_giftbox.txt", gift_box, &gift_box_count, &gift_box_default },
- {"db/item_scroll.txt", scroll, &scroll_count, &scroll_default },
+ {"db/item_giftbox.txt", gift_box, &gift_box_count, &gift_box_default },
+ {"db/item_scroll.txt", scroll, &scroll_count, &scroll_default },
+ {"db/item_findingore.txt", finding_ore,&finding_ore_count, &finding_ore_default },
};
for(i=0;i<sizeof(data)/sizeof(data[0]);i++){
diff --git a/src/map/mob.c b/src/map/mob.c
index b46b2a317..c9626fa72 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2624,11 +2624,10 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
}
// Ore Discovery [Celest]
- if (sd && pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/100 >= rand()%1000) {
+ if (sd == mvp_sd && pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/100 >= rand()%1000) {
struct delay_item_drop *ditem;
- int itemid[17] = { 714, 756, 757, 969, 984, 985, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1002 };
ditem=(struct delay_item_drop *)aCalloc(1,sizeof(struct delay_item_drop));
- ditem->nameid = itemid[rand()%17]; //should return from 0 to 16
+ ditem->nameid = itemdb_searchrandomid(6);
if (drop_ore<0) i=8; //we have only 10 slots in LOG, there's a check to not overflow (9th item usually a card, so we use 8th slot)
log_item[i] = ditem->nameid; //it's for logging only
drop_items++; //we cound if there were any drops
diff --git a/src/map/party.c b/src/map/party.c
index 17f0cf5eb..7eb3f02dc 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -586,23 +586,23 @@ int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny)
nullpo_retr(0, p);
- for(i=c=0;i<MAX_PARTY;i++)
- if((sd=p->member[i].sd)!=NULL && p->member[i].online && sd->bl.m==map && session[sd->fd] != NULL)
+ for (i=c=0; i < MAX_PARTY; i++)
+ if ((sd = p->member[i].sd) != NULL && p->member[i].online && sd->bl.m == map /*&& session[sd->fd] != NULL*/) // should be done in socket.c
c++;
-
- if(c==0)
+
+ if(c == 0)
return 0;
- for(i=0;i<MAX_PARTY;i++)
- if((sd=p->member[i].sd)!=NULL && p->member[i].online && sd->bl.m==map && session[sd->fd] != NULL) {
- if (/* pc_issit(sd) || */ sd->chatID || (sd->idletime < (tick_ - 120)))
+ for (i = 0; i < MAX_PARTY; i++)
+ if ((sd = p->member[i].sd) != NULL && p->member[i].online && sd->bl.m == map /*&& session[sd->fd] != NULL*/) {
+ if (battle_config.idle_no_share && (/* pc_issit(sd) || */ sd->chatID || (sd->idletime < (tick_ - 120))))
continue;
-#ifdef TWILIGHT
+ #ifdef TWILIGHT
pc_gainexp(sd,base_exp,job_exp);
-#else
- pc_gainexp(sd,base_exp/c+1,job_exp/c+1);
-#endif
- if(battle_config.zeny_from_mobs) // zeny from mobs [Valaris]
- pc_getzeny(sd,zeny/c+1);
+ #else
+ pc_gainexp(sd,(base_exp/c)+1,(job_exp/c)+1);
+ #endif
+ if (battle_config.zeny_from_mobs) // zeny from mobs [Valaris]
+ pc_getzeny(sd,(zeny/c)+1);
}
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 40626fa57..b6010f151 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -608,8 +608,8 @@ int skillnotok(int skillid, struct map_session_data *sd)
return 1;
}
- if (pc_isGM(sd) >= 20)
- return 0; // gm's can do anything damn thing they want
+ if (pc_isGM(sd) >= 20)
+ return 0; // gm's can do anything damn thing they want
// Check skill restrictions [Celest]
if(!map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.gvg && skill_get_nocast (skillid) & 1)
@@ -630,7 +630,7 @@ int skillnotok(int skillid, struct map_session_data *sd)
case MC_IDENTIFY:
return 0; // always allowed
default:
- return(map[sd->bl.m].flag.noskill);
+ return (map[sd->bl.m].flag.noskill);
}
}
@@ -639,9 +639,9 @@ static int distance(int x0,int y0,int x1,int y1)
{
int dx,dy;
- dx=abs(x0-x1);
- dy=abs(y0-y1);
- return dx>dy ? dx : dy;
+ dx = abs(x0 - x1);
+ dy = abs(y0 - y1);
+ return dx > dy ? dx : dy;
}
/* スキルユニットの配置情報を返す */
@@ -649,26 +649,25 @@ struct skill_unit_layout skill_unit_layout[MAX_SKILL_UNIT_LAYOUT];
int firewall_unit_pos;
int icewall_unit_pos;
-struct skill_unit_layout *skill_get_unit_layout(int skillid,int skilllv,struct block_list *src,int x,int y)
-{
-
+struct skill_unit_layout *skill_get_unit_layout (int skillid, int skilllv, struct block_list *src, int x, int y)
+{
int pos = skill_get_unit_layout_type(skillid,skilllv);
int dir;
- if (pos!=-1)
+ if (pos != -1)
return &skill_unit_layout[pos];
- if (src->x==x && src->y==y)
+ if (src->x == x && src->y == y)
dir = 2;
else
dir = map_calc_dir(src,x,y);
- if (skillid==MG_FIREWALL)
- return &skill_unit_layout[firewall_unit_pos+dir];
- else if (skillid==WZ_ICEWALL)
- return &skill_unit_layout[icewall_unit_pos+dir];
+ if (skillid == MG_FIREWALL)
+ return &skill_unit_layout [firewall_unit_pos + dir];
+ else if (skillid == WZ_ICEWALL)
+ return &skill_unit_layout [icewall_unit_pos + dir];
- printf("unknown unit layout for skill %d, %d\n",skillid,skilllv);
+ printf("Unknown unit layout for skill %d, %d\n",skillid,skilllv);
return &skill_unit_layout[0];
}
@@ -691,7 +690,7 @@ struct skill_unit_layout *skill_get_unit_layout(int skillid,int skilllv,struct b
* スキル追加?果
*------------------------------------------
*/
-int skill_additional_effect( struct block_list* src, struct block_list *bl,int skillid,int skilllv,int attack_type,unsigned int tick)
+int skill_additional_effect (struct block_list* src, struct block_list *bl, int skillid, int skilllv, int attack_type, unsigned int tick)
{
/* MOB追加?果スキル用 */
const int sc[]={
@@ -825,8 +824,9 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s
case WZ_FROSTNOVA: /* フロストノヴァ */
{
struct status_change *sc_data = status_get_sc_data(bl);
- rate=(skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15;
- rate=rate<=5?5:rate;
+ rate = (skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15;
+ if (rate <= 5)
+ rate = 5;
if(sc_data && sc_data[SC_FREEZE].timer == -1 && rand()%100 < rate)
status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv)*(1-sc_def_mdef/100),0);
else if (sd && skillid == MG_FROSTDIVER)
@@ -2384,9 +2384,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
case SM_MAGNUM: /* マグナムブレイク [celest] */
if(flag&1 && bl->id != skill_area_temp[1]){
- int dx = abs( bl->x - skill_area_temp[2] );
- int dy = abs( bl->y - skill_area_temp[3] );
- int dist = ((dx>dy)?dx:dy);
+ int dist = distance (bl->x, bl->y, skill_area_temp[2], skill_area_temp[3]);
skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,
0x0500|dist);
} else {
@@ -2514,18 +2512,16 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
case MG_NAPALMBEAT: /* ナパ?ムビ?ト */
case MG_FIREBALL: /* ファイヤ?ボ?ル */
case WZ_SIGHTRASHER: /* サイトラッシャー */
- if(flag&1){
+ if (flag & 1) {
/* 個別にダメ?ジを?える */
- if(bl->id!=skill_area_temp[1]){
- if(skillid==MG_FIREBALL){ /* ファイヤ?ボ?ルなら中心からの距離を計算 */
- int dx=abs( bl->x - skill_area_temp[2] );
- int dy=abs( bl->y - skill_area_temp[3] );
- skill_area_temp[0]=((dx>dy)?dx:dy);
+ if (bl->id != skill_area_temp[1]){
+ if(skillid == MG_FIREBALL){ /* ファイヤ?ボ?ルなら中心からの距離を計算 */
+ skill_area_temp[0] = distance(bl->x, bl->y, skill_area_temp[2], skill_area_temp[3]);
}
skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,
skill_area_temp[0]| 0x0500);
}
- }else{
+ } else {
int ar;
skill_area_temp[0]=0;
skill_area_temp[1]=bl->id;