diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/mmo.h | 73 | ||||
-rw-r--r-- | src/map/atcommand.c | 5 | ||||
-rw-r--r-- | src/map/clif.c | 8 | ||||
-rw-r--r-- | src/map/pc.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 14 | ||||
-rw-r--r-- | src/map/skill.c | 9 | ||||
-rw-r--r-- | src/map/status.h | 8 | ||||
-rw-r--r-- | src/map/vending.c | 2 |
8 files changed, 101 insertions, 20 deletions
diff --git a/src/common/mmo.h b/src/common/mmo.h index a2080d900..3d3360132 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -125,29 +125,69 @@ //Official Limit: 2.1b ( the var that stores the money doesn't go much higher than this by default ) #define MAX_BANK_ZENY INT_MAX +#ifndef MAX_LEVEL #define MAX_LEVEL 175 +#endif #define MAX_FAME 1000000000 #define MAX_CART 100 +#ifndef MAX_SKILL #define MAX_SKILL 1478 +#endif +#ifndef MAX_SKILL_ID #define MAX_SKILL_ID 10015 // [Ind/Hercules] max used skill ID +#endif +#ifndef MAX_SKILL_TREE // Update this max as necessary. 86 is the value needed for Expanded Super Novice. #define MAX_SKILL_TREE 86 +#endif +#ifndef DEFAULT_WALK_SPEED #define DEFAULT_WALK_SPEED 150 +#endif +#ifndef MIN_WALK_SPEED #define MIN_WALK_SPEED 20 /* below 20 clips animation */ +#endif +#ifndef MAX_WALK_SPEED #define MAX_WALK_SPEED 1000 +#endif +#ifndef MAX_STORAGE #define MAX_STORAGE 600 +#endif +#ifndef MAX_GUILD_STORAGE #define MAX_GUILD_STORAGE 600 +#endif +#ifndef MAX_PARTY #define MAX_PARTY 12 +#endif +#ifndef BASE_GUILD_SIZE #define BASE_GUILD_SIZE 16 // Base guild members (without GD_EXTENSION) +#endif +#ifndef MAX_GUILD #define MAX_GUILD (BASE_GUILD_SIZE+10*6) // Increased max guild members +6 per 1 extension levels [Lupus] +#endif +#ifndef MAX_GUILDPOSITION #define MAX_GUILDPOSITION 20 // Increased max guild positions to accomodate for all members [Valaris] (removed) [PoW] +#endif +#ifndef MAX_GUILDEXPULSION #define MAX_GUILDEXPULSION 32 +#endif +#ifndef MAX_GUILDALLIANCE #define MAX_GUILDALLIANCE 16 +#endif +#ifndef MAX_GUILDSKILL #define MAX_GUILDSKILL 15 // Increased max guild skills because of new skills [Sara-chan] +#endif +#ifndef MAX_GUILDLEVEL #define MAX_GUILDLEVEL 50 +#endif +#ifndef MAX_GUARDIANS #define MAX_GUARDIANS 8 // Local max per castle. [Skotlex] +#endif +#ifndef MAX_QUEST_OBJECTIVES #define MAX_QUEST_OBJECTIVES 3 // Max quest objectives for a quest +#endif +#ifndef MAX_START_ITEMS #define MAX_START_ITEMS 32 // Max number of items allowed to be given to a char whenever it's created. [mkbu95] +#endif // for produce #define MIN_ATTRIBUTE 0 @@ -170,7 +210,9 @@ #define MAP_NAME_LENGTH (11 + 1) #define MAP_NAME_LENGTH_EXT (MAP_NAME_LENGTH + 4) +#ifndef MAX_FRIENDS #define MAX_FRIENDS 40 +#endif #define MAX_MEMOPOINTS 3 // Size of the fame list arrays. @@ -186,8 +228,12 @@ #define MAX_GUILDMES2 120 // Base Homun skill. +#ifndef HM_SKILLBASE #define HM_SKILLBASE 8001 +#endif +#ifndef MAX_HOMUNSKILL #define MAX_HOMUNSKILL 43 +#endif // Mail System #define MAIL_MAX_INBOX 30 @@ -195,13 +241,23 @@ #define MAIL_BODY_LENGTH 200 // Mercenary System +#ifndef MC_SKILLBASE #define MC_SKILLBASE 8201 +#endif +#ifndef MAX_MERCSKILL #define MAX_MERCSKILL 40 +#endif // Elemental System +#ifndef MAX_ELEMENTALSKILL #define MAX_ELEMENTALSKILL 42 +#endif +#ifndef EL_SKILLBASE #define EL_SKILLBASE 8401 +#endif +#ifndef MAX_ELESKILLTREE #define MAX_ELESKILLTREE 3 +#endif // The following system marks a different job ID system used by the map server, // which makes a lot more sense than the normal one. [Skotlex] @@ -233,7 +289,9 @@ enum item_types { IT_AMMO, //10 IT_DELAYCONSUME,//11 IT_CASH = 18, +#ifndef IT_MAX IT_MAX +#endif }; #define INDEX_NOT_FOUND (-1) ///< Used as invalid/failure value in various functions that return an index @@ -253,6 +311,11 @@ struct quest { enum quest_state state; ///< Current quest state }; +enum attribute_flag { + ATTR_NONE = 0, + ATTR_BROKEN = 1, +}; + struct item { int id; short nameid; @@ -325,7 +388,9 @@ enum e_item_bound_type { IBT_GUILD = 0x2, IBT_PARTY = 0x3, IBT_CHARACTER = 0x4, +#ifndef IBT_MAX IBT_MAX = 0x4, +#endif }; enum { @@ -772,7 +837,9 @@ enum { GD_RESTORE=10012, GD_EMERGENCYCALL=10013, GD_DEVELOPMENT=10014, +#ifndef GD_MAX GD_MAX, +#endif }; //These mark the ID of the jobs, as expected by the client. [Skotlex] @@ -929,7 +996,9 @@ enum { JOB_OBORO, JOB_REBELLION = 4215, +#ifndef JOB_MAX JOB_MAX, +#endif }; //Total number of classes (for data storage) @@ -966,7 +1035,9 @@ enum weapon_type { W_GRENADE, //21 W_HUUMA, //22 W_2HSTAFF, //23 +#ifndef MAX_SINGLE_WEAPON_TYPE MAX_SINGLE_WEAPON_TYPE, +#endif // dual-wield constants W_DOUBLE_DD, ///< 2 daggers W_DOUBLE_SS, ///< 2 swords @@ -974,7 +1045,9 @@ enum weapon_type { W_DOUBLE_DS, ///< dagger + sword W_DOUBLE_DA, ///< dagger + axe W_DOUBLE_SA, ///< sword + axe +#ifndef MAX_WEAPON_TYPE MAX_WEAPON_TYPE, +#endif }; enum ammo_type { diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 094e64e2a..858bfea1b 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4137,8 +4137,9 @@ ACMD(repairall) count = 0; for (i = 0; i < MAX_INVENTORY; i++) { - if (sd->status.inventory[i].nameid && sd->status.inventory[i].attribute == 1) { - sd->status.inventory[i].attribute = 0; + if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { + sd->status.inventory[i].attribute |= ATTR_BROKEN; + sd->status.inventory[i].attribute ^= ATTR_BROKEN; clif->produce_effect(sd, 0, sd->status.inventory[i].nameid); count++; } diff --git a/src/map/clif.c b/src/map/clif.c index 13a7b0839..21c3c1c3e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2397,7 +2397,7 @@ void clif_additem(struct map_session_data *sd, int n, int amount, int fail) { p.nameid = sd->status.inventory[n].nameid; p.IsIdentified = sd->status.inventory[n].identify ? 1 : 0; - p.IsDamaged = sd->status.inventory[n].attribute ? 1 : 0; + p.IsDamaged = (sd->status.inventory[n].attribute & ATTR_BROKEN) != 0 ? 1 : 0; p.refiningLevel =sd->status.inventory[n].refine; clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]); p.location = pc->equippoint(sd,n); @@ -2512,7 +2512,7 @@ void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct p->location = eqp_pos; p->WearState = i->equip; #if PACKETVER < 20120925 - p->IsDamaged = i->attribute ? 1 : 0; + p->IsDamaged = (i->attribute & ATTR_BROKEN) != 0 ? 1 : 0; #endif p->RefiningLevel = i->refine; @@ -2532,7 +2532,7 @@ void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *i, struct #if PACKETVER >= 20120925 p->Flag.IsIdentified = i->identify ? 1 : 0; - p->Flag.IsDamaged = i->attribute ? 1 : 0; + p->Flag.IsDamaged = (i->attribute & ATTR_BROKEN) != 0 ? 1 : 0; p->Flag.PlaceETCTab = i->favorite ? 1 : 0; p->Flag.SpareBits = 0; #endif @@ -6020,7 +6020,7 @@ void clif_item_repair_list(struct map_session_data *sd,struct map_session_data * WFIFOW(fd,0)=0x1fc; for (i = c = 0; i < MAX_INVENTORY; i++) { int nameid = dstsd->status.inventory[i].nameid; - if (nameid > 0 && dstsd->status.inventory[i].attribute != 0) { // && skill_can_repair(sd,nameid)) { + if (nameid > 0 && (dstsd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { // && skill_can_repair(sd,nameid)) { WFIFOW(fd,c*13+4) = i; WFIFOW(fd,c*13+6) = nameid; WFIFOB(fd,c*13+8) = dstsd->status.inventory[i].refine; diff --git a/src/map/pc.c b/src/map/pc.c index 6dc10ae08..22a820b13 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9689,7 +9689,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) if(battle_config.battle_log) ShowInfo("equip %d(%d) %x:%x\n", sd->status.inventory[n].nameid, n, (unsigned int)(id ? id->equip : 0), (unsigned int)req_pos); - if(!pc->isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris] + if(!pc->isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || (sd->status.inventory[n].attribute & ATTR_BROKEN) != 0 ) { // [Valaris] // FIXME: pc->isequip: equip level failure uses 2 instead of 0 clif->equipitemack(sd,n,0,EIA_FAIL); // fail return 0; diff --git a/src/map/script.c b/src/map/script.c index 64966f987..12f7dd43c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8604,7 +8604,7 @@ BUILDIN(getbrokenid) num=script_getnum(st,2); for(i=0; i<MAX_INVENTORY; i++) { - if(sd->status.inventory[i].attribute) { + if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { brokencounter++; if(num==brokencounter) { id=sd->status.inventory[i].nameid; @@ -8629,7 +8629,7 @@ BUILDIN(getbrokencount) return true; for (i = 0; i < MAX_INVENTORY; i++) { - if (sd->status.inventory[i].attribute) + if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) counter++; } @@ -8651,10 +8651,11 @@ BUILDIN(repair) num=script_getnum(st,2); for(i=0; i<MAX_INVENTORY; i++) { - if(sd->status.inventory[i].attribute) { + if ((sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { repaircounter++; if(num==repaircounter) { - sd->status.inventory[i].attribute=0; + sd->status.inventory[i].attribute |= ATTR_BROKEN; + sd->status.inventory[i].attribute ^= ATTR_BROKEN; clif->equiplist(sd); clif->produce_effect(sd, 0, sd->status.inventory[i].nameid); clif->misceffect(&sd->bl, 3); @@ -8678,9 +8679,10 @@ BUILDIN(repairall) for(i = 0; i < MAX_INVENTORY; i++) { - if(sd->status.inventory[i].nameid && sd->status.inventory[i].attribute) + if (sd->status.inventory[i].nameid && (sd->status.inventory[i].attribute & ATTR_BROKEN) != 0) { - sd->status.inventory[i].attribute = 0; + sd->status.inventory[i].attribute |= ATTR_BROKEN; + sd->status.inventory[i].attribute ^= ATTR_BROKEN; clif->produce_effect(sd,0,sd->status.inventory[i].nameid); repaircounter++; } diff --git a/src/map/skill.c b/src/map/skill.c index d641bee75..6c62e88dd 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2005,7 +2005,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in if (sd) { for (i = 0; i < EQI_MAX; i++) { int j = sd->equip_index[i]; - if (j < 0 || sd->status.inventory[j].attribute == 1 || !sd->inventory_data[j]) + if (j < 0 || (sd->status.inventory[j].attribute & ATTR_BROKEN) != 0 || !sd->inventory_data[j]) continue; switch(i) { @@ -2031,7 +2031,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in continue; } if (flag) { - sd->status.inventory[j].attribute = 1; + sd->status.inventory[j].attribute |= ATTR_BROKEN; pc->unequipitem(sd, j, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); } } @@ -15222,7 +15222,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) { return; //Invalid index?? item = &target_sd->status.inventory[idx]; - if( item->nameid <= 0 || item->attribute == 0 ) + if( item->nameid <= 0 || (item->attribute & ATTR_BROKEN) == 0 ) return; //Again invalid item.... if( sd != target_sd && !battle->check_range(&sd->bl,&target_sd->bl, skill->get_range2(&sd->bl, sd->menuskill_id,sd->menuskill_val2) ) ){ @@ -15241,7 +15241,8 @@ void skill_repairweapon (struct map_session_data *sd, int idx) { clif->skill_nodamage(&sd->bl,&target_sd->bl,sd->menuskill_id,1,1); - item->attribute = 0;/* clear broken state */ + item->attribute |= ATTR_BROKEN; + item->attribute ^= ATTR_BROKEN; /* clear broken state */ clif->equiplist(target_sd); diff --git a/src/map/status.h b/src/map/status.h index 2b932b149..2f70ee41d 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -64,7 +64,9 @@ enum refine_type { REFINE_TYPE_WEAPON2 = 2, REFINE_TYPE_WEAPON3 = 3, REFINE_TYPE_WEAPON4 = 4, +#ifndef REFINE_TYPE_MAX REFINE_TYPE_MAX = 5 +#endif }; /** @@ -825,8 +827,9 @@ typedef enum sc_type { SC_M_LIFEPOTION, SC_G_LIFEPOTION, // 640 SC_MYSTICPOWDER, - +#ifndef SC_MAX SC_MAX, //Automatically updated max, used in for's to check we are within bounds. +#endif } sc_type; /// Official status change ids, used to display status icons in the client. @@ -1792,8 +1795,9 @@ enum si_type { //SI_EP16_2_BUFF_SS = 963, //SI_EP16_2_BUFF_SC = 964, //SI_EP16_2_BUFF_AC = 965, - +#ifndef SI_MAX SI_MAX, +#endif }; // JOINTBEAT stackable ailments diff --git a/src/map/vending.c b/src/map/vending.c index e3a62bea7..3ae1017f8 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -276,7 +276,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const || pc->cartitem_amount(sd, index, amount) < 0 // invalid item or insufficient quantity //NOTE: official server does not do any of the following checks! || !sd->status.cart[index].identify // unidentified item - || sd->status.cart[index].attribute == 1 // broken item + || (sd->status.cart[index].attribute & ATTR_BROKEN) != 0 // broken item || sd->status.cart[index].expire_time // It should not be in the cart but just in case || (sd->status.cart[index].bound && !pc_can_give_bound_items(sd)) // can't trade bound items w/o permission || !itemdb_cantrade(&sd->status.cart[index], pc_get_group_level(sd), pc_get_group_level(sd)) ) // untradeable item |