Advertisement
Guest User

@costumeitem DIFF

a guest
Jul 24th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.28 KB | None | 0 0
  1. Index: conf/battle/battle.conf
  2. ===================================================================
  3. --- conf/battle/battle.conf (revision 14148)
  4. +++ conf/battle/battle.conf (working copy)
  5. @@ -142,3 +142,22 @@
  6.  // range. For example, Sonic Blow requires a 2 cell distance before autocasting is allowed.
  7.  // This setting also affects autospellwhenhit.
  8.  autospell_check_range: no
  9. +
  10. +// ****************************************
  11. +// Reserved Costume ID's
  12. +// ****************************************
  13. +// Reserved Char ID for costume converted items.
  14. +reserved_costume_id: 999998
  15. Index: src/map/atcommand.c
  16. ===================================================================
  17. --- src/map/atcommand.c (revision 14148)
  18. +++ src/map/atcommand.c (working copy)
  19. @@ -1112,7 +1112,7 @@
  20.  ACMD(item)
  21.  {
  22.     char item_name[100];
  23. -   int number = 0, item_id, flag = 0, bound = 0;
  24. +   int number = 0, item_id, flag = 0, bound = 0, costume = 0;
  25.     struct item item_tmp;
  26.     struct item_data *item_data;
  27.     int get_count, i;
  28. @@ -1166,7 +1166,27 @@
  29.                 break;
  30.         }
  31.     }
  32. -
  33. +  
  34. +       if( !strcmpi(command+1,"costumeitem") )
  35. +   {
  36. +       if( !battle_config.reserved_costume_id )
  37. +       {
  38. +           clif->message(fd, "Costume conversion is disable. Set a value for reserved_cosutme_id on your battle.conf file.");
  39. +           return -1;
  40. +       }
  41. +       if( !(item_data->equip&EQP_HEAD_LOW) &&
  42. +           !(item_data->equip&EQP_HEAD_MID) &&
  43. +           !(item_data->equip&EQP_HEAD_TOP) &&
  44. +           !(item_data->equip&EQP_COSTUME_HEAD_LOW) &&
  45. +           !(item_data->equip&EQP_COSTUME_HEAD_MID) &&
  46. +           !(item_data->equip&EQP_COSTUME_HEAD_TOP) )
  47. +       {
  48. +           clif->message(fd, "You cannot costume this item. Costume only work for headgears.");
  49. +           return -1;
  50. +       }
  51. +       costume = 1;
  52. +   }
  53. +  
  54.     item_id = item_data->nameid;
  55.     get_count = number;
  56.     //Check if it's stackable.
  57. @@ -1186,6 +1206,14 @@
  58.             item_tmp.identify = 1;
  59.             item_tmp.bound = (unsigned char)bound;
  60.            
  61. +           if( costume == 1 )
  62. +           { // Costume Item
  63. +               item_tmp.card[0] = CARD0_CREATE;
  64. +               item_tmp.card[2] = GetWord(battle_config.reserved_costume_id, 0);
  65. +               item_tmp.card[3] = GetWord(battle_config.reserved_costume_id, 1);
  66. +           }
  67. +          
  68. +          
  69.             if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
  70.                 clif->additem(sd, 0, 0, flag);
  71.         }
  72. @@ -9664,6 +9692,7 @@
  73.         ACMD_DEF(searchstore),
  74.         ACMD_DEF(costume),
  75.         ACMD_DEF(skdebug),
  76. +       ACMD_DEF2("costumeitem", item)
  77.     };
  78.     int i;
  79.    
  80. Index: src/map/battle.c
  81. ===================================================================
  82. --- src/map/battle.c    (revision 14148)
  83. +++ src/map/battle.c    (working copy)
  84. @@ -6739,6 +6739,7 @@
  85.     { "feature.banking",                    &battle_config.feature_banking,                 1,      0,      1,              },
  86.     { "feature.auction",                    &battle_config.feature_auction,                 0,      0,      2,              },
  87.     { "idletime_criteria",                  &battle_config.idletime_criteria,            0x25,      1,      INT_MAX,        },
  88. +   { "reserved_costume_id",                &battle_config.reserved_costume_id,             999998, 0,      INT_MAX,        },
  89.  
  90.     { "mon_trans_disable_in_gvg",           &battle_config.mon_trans_disable_in_gvg,        0,      0,      1,              },
  91.     { "case_sensitive_aegisnames",          &battle_config.case_sensitive_aegisnames,       1,      0,      1,              },
  92. Index: src/map/battle.h
  93. ===================================================================
  94. --- src/map/battle.h    (revision 14148)
  95. +++ src/map/battle.h    (working copy)
  96. @@ -448,6 +448,9 @@
  97.     int min_npc_vendchat_distance;
  98.     int atcommand_mobinfo_type;
  99.    
  100. +   // Costume System
  101. +   int reserved_costume_id;
  102. +
  103.     int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95]
  104.    
  105.     /** Hercules **/
  106. Index: src/map/map.c
  107. ===================================================================
  108. --- src/map/map.c   (revision 14148)
  109. +++ src/map/map.c   (working copy)
  110. @@ -1588,6 +1588,13 @@
  111.  
  112.     nullpo_retv(sd);
  113.  
  114. +      
  115. +   if( battle_config.reserved_costume_id && battle_config.reserved_costume_id == charid )
  116. +   {
  117. +       clif->solved_charname(sd->fd, charid, "COSTUME");
  118. +       return;
  119. +   }
  120. +  
  121.     tsd = map->charid2sd(charid);
  122.     if( tsd ) {
  123.         clif->solved_charname(sd->fd, charid, tsd->status.name);
  124. Index: src/map/pc.c
  125. ===================================================================
  126. --- src/map/pc.c    (revision 14148)
  127. +++ src/map/pc.c    (working copy)
  128. @@ -632,8 +632,8 @@
  129.  
  130.  int pc_equippoint(struct map_session_data *sd,int n)
  131.  {
  132. -   int ep = 0;
  133. -
  134. +   int ep = 0, char_id = 0;
  135. +  
  136.     nullpo_ret(sd);
  137.  
  138.     if(!sd->inventory_data[n])
  139. @@ -655,6 +655,14 @@
  140.                 return EQP_SHADOW_ARMS;
  141.         }
  142.     }
  143. +   if( battle_config.reserved_costume_id &&
  144. +       sd->status.inventory[n].card[0] == CARD0_CREATE &&
  145. +       (char_id = MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3])) == battle_config.reserved_costume_id )
  146. +   { // Costume Item - Converted
  147. +       if( ep&EQP_HEAD_TOP ) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
  148. +       if( ep&EQP_HEAD_LOW ) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
  149. +       if( ep&EQP_HEAD_MID ) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
  150. +   }
  151.     return ep;
  152.  }
  153.  
  154. @@ -8525,6 +8533,9 @@
  155.                 if( k == EQI_HEAD_MID &&  sd->equip_index[EQI_HEAD_LOW] == index ) continue;
  156.                 if( k == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index) ) continue;
  157.  
  158. +               if( (int)MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) == battle_config.reserved_costume_id )
  159. +               continue;
  160. +              
  161.                 if(!sd->inventory_data[index])
  162.                     continue;
  163.                
  164. Index: src/map/script.c
  165. ===================================================================
  166. --- src/map/script.c    (revision 14148)
  167. +++ src/map/script.c    (working copy)
  168. @@ -18595,6 +18595,51 @@
  169.     return true;
  170.  }
  171.  
  172. +/*==========================================
  173. + * Costume Items Hercules /[Mhalicot]
  174. + *------------------------------------------*/
  175. +BUILDIN(costume)
  176. +{
  177. +   int i = -1, num, ep;
  178. +   TBL_PC *sd;
  179. +
  180. +   num = script_getnum(st,2); // Equip Slot
  181. +   sd = script->rid2sd(st);
  182. +
  183. +   if( sd == NULL )
  184. +       return 0;
  185. +   if( num > 0 && num <= ARRAYLENGTH(script->equip) )
  186. +       i = pc->checkequip(sd, script->equip[num - 1]);
  187. +   if( i < 0 )
  188. +       return 0;
  189. +   ep = sd->status.inventory[i].equip;
  190. +   if( !(ep&EQP_HEAD_LOW) && !(ep&EQP_HEAD_MID) && !(ep&EQP_HEAD_TOP) )
  191. +       return 0;
  192. +
  193. +   logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
  194. +   pc->unequipitem(sd,i,2);
  195. +   clif->delitem(sd,i,1,3);
  196. +   // --------------------------------------------------------------------
  197. +   sd->status.inventory[i].refine = 0;
  198. +   sd->status.inventory[i].attribute = 0;
  199. +   sd->status.inventory[i].card[0] = CARD0_CREATE;
  200. +   sd->status.inventory[i].card[1] = 0;
  201. +   sd->status.inventory[i].card[2] = GetWord(battle_config.reserved_costume_id, 0);
  202. +   sd->status.inventory[i].card[3] = GetWord(battle_config.reserved_costume_id, 1);
  203. +
  204. +   if( ep&EQP_HEAD_TOP ) { ep &= ~EQP_HEAD_TOP; ep |= EQP_COSTUME_HEAD_TOP; }
  205. +   if( ep&EQP_HEAD_LOW ) { ep &= ~EQP_HEAD_LOW; ep |= EQP_COSTUME_HEAD_LOW; }
  206. +   if( ep&EQP_HEAD_MID ) { ep &= ~EQP_HEAD_MID; ep |= EQP_COSTUME_HEAD_MID; }
  207. +   // --------------------------------------------------------------------
  208. +   logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
  209. +
  210. +   clif->additem(sd,i,1,0);
  211. +   pc->equipitem(sd,i,ep);
  212. +   clif->misceffect(&sd->bl,3);
  213. +
  214. +   return true;
  215. +}
  216. +
  217.  // declarations that were supposed to be exported from npc_chat.c
  218.  #ifdef PCRE_SUPPORT
  219.  BUILDIN(defpattern);
  220. @@ -19175,6 +19220,9 @@
  221.         BUILDIN_DEF(changequest, "ii"),
  222.         BUILDIN_DEF(showevent, "i?"),
  223.  
  224. +       // Costume System
  225. +       BUILDIN_DEF(costume,"i"),
  226. +      
  227.         /**
  228.          * hQueue [Ind/Hercules]
  229.          **/
  230. Index: src/map/status.c
  231. ===================================================================
  232. --- src/map/status.c    (revision 14148)
  233. +++ src/map/status.c    (working copy)
  234. @@ -2540,6 +2540,8 @@
  235.             continue;
  236.         if(i == EQI_COSTUME_TOP && (sd->equip_index[EQI_COSTUME_MID] == index || sd->equip_index[EQI_COSTUME_LOW] == index))
  237.             continue;
  238. +       if( (int)MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) == battle_config.reserved_costume_id )
  239. +           continue;
  240.         if(!sd->inventory_data[index])
  241.             continue;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement