Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/common/mmo.h
- ===================================================================
- --- src/common/mmo.h (revision 14956)
- +++ src/common/mmo.h (working copy)
- @@ -111,7 +111,7 @@
- // for produce
- #define MIN_ATTRIBUTE 0
- -#define MAX_ATTRIBUTE 4
- +#define MAX_ATTRIBUTE 5
- #define ATTRIBUTE_NORMAL 0
- #define MIN_STAR 0
- #define MAX_STAR 3
- Index: src/map/atcommand.c
- ===================================================================
- --- src/map/atcommand.c (revision 14956)
- +++ src/map/atcommand.c (working copy)
- @@ -1712,6 +1712,77 @@
- return 0;
- }
- +// Costume Item System [GreenBox]
- +ACMD_FUNC(costumeitem)
- +{
- + struct item item_tmp;
- + struct item_data *item_data;
- + char item_name[100];
- + int item_id, number = 0;
- + int flag;
- + int loop, get_count, i;
- + nullpo_retr(-1, sd);
- +
- + memset(item_name, '\0', sizeof(item_name));
- +
- + if (!message || !*message || (
- + sscanf(message, "\"%99[^\"]\" %", item_name, &number) < 1 &&
- + sscanf(message, "%99s %d", item_name, &number) < 1
- + )) {
- + clif_displaymessage(fd, "Por favor, entre com todas as informações (uso: @costumeitem <nome/ID do item> <quantidade>).");
- + return -1;
- + }
- +
- + if (number <= 0)
- + number = 1;
- +
- + item_id = 0;
- + if ((item_data = itemdb_searchname(item_name)) != NULL ||
- + (item_data = itemdb_exists(atoi(item_name))) != NULL)
- + item_id = item_data->nameid;
- +
- + if (item_id > 500) {
- + loop = 1;
- + get_count = number;
- + if (!(item_data->equip&EQP_HEAD_LOW) &&
- + !(item_data->equip&EQP_HEAD_LOW_C) &&
- + !(item_data->equip&EQP_HEAD_MID) &&
- + !(item_data->equip&EQP_HEAD_MID_C) &&
- + !(item_data->equip&EQP_HEAD_TOP) &&
- + !(item_data->equip&EQP_HEAD_TOP_C)
- + )
- + {
- + clif_displaymessage(fd, "Este item não pode virar um costume.");
- + return;
- + }
- +
- + for (i = 0; i < loop; i++) {
- + memset(&item_tmp, 0, sizeof(item_tmp));
- + item_tmp.nameid = item_id;
- + item_tmp.identify = 1;
- + item_tmp.refine = 0;
- + item_tmp.attribute = 5;
- + item_tmp.card[0] = 0;
- + item_tmp.card[1] = 0;
- + item_tmp.card[2] = 0;
- + item_tmp.card[3] = 0;
- + if ((flag = pc_additem(sd, &item_tmp, get_count)))
- + clif_additem(sd, 0, 0, flag);
- + }
- +
- + //Logs (A)dmins items [Lupus]
- + if(log_config.enable_logs&0x400)
- + log_pick_pc(sd, "A", item_tmp.nameid, number, &item_tmp);
- +
- + clif_displaymessage(fd, msg_txt(18)); // Item criado.
- + } else {
- + clif_displaymessage(fd, msg_txt(19)); // Nome/ID inválido.
- + return -1;
- + }
- +
- + return 0;
- +}
- +
- /*==========================================
- *
- *------------------------------------------*/
- @@ -8704,6 +8775,7 @@
- { "heal", 40,60, atcommand_heal },
- { "item", 60,60, atcommand_item },
- { "item2", 60,60, atcommand_item2 },
- + { "costumeitem", 60,60, atcommand_costumeitem },
- { "itemreset", 40,40, atcommand_itemreset },
- { "blvl", 60,60, atcommand_baselevelup },
- { "lvup", 60,60, atcommand_baselevelup },
- Index: src/map/clif.c
- ===================================================================
- --- src/map/clif.c (revision 14956)
- +++ src/map/clif.c (working copy)
- @@ -1868,6 +1868,13 @@
- WBUFW(buf,6) = item->card[3];
- return;
- }
- + if( item->attribute == 5 ) { // Costume Item Check [GreenBox - Cronus]
- + WBUFW(buf,0) = CARD0_CREATE;
- + WBUFW(buf,2) = 0x0000;
- + WBUFW(buf,4) = 0x0007;
- + WBUFW(buf,6) = 0x0000;
- + return;
- + }
- //Client only receives four cards.. so randomly send them a set of cards. [Skotlex]
- if( MAX_SLOTS > 4 && (j = itemdb_slot(item->nameid)) > 4 )
- i = rand()%(j-3); //eg: 6 slots, possible i values: 0->3, 1->4, 2->5 => i = rand()%3;
- @@ -1948,6 +1955,10 @@
- WFIFOW(fd,6)=sd->status.inventory[n].nameid;
- WFIFOB(fd,8)=sd->status.inventory[n].identify;
- WFIFOB(fd,9)=sd->status.inventory[n].attribute;
- + if (sd->status.inventory[n].attribute==5)
- + WFIFOB(fd,9)=0;
- + else
- + WFIFOB(fd,9)=sd->status.inventory[n].attribute;
- WFIFOB(fd,10)=sd->status.inventory[n].refine;
- clif_addcards(WFIFOP(fd,11), &sd->status.inventory[n]);
- WFIFOW(fd,19)=pc_equippoint(sd,n);
- @@ -2033,7 +2044,10 @@
- if (equip >= 0) { //Equippable item
- WBUFW(buf,n+4)=equip;
- WBUFW(buf,n+6)=i->equip;
- - WBUFB(buf,n+8)=i->attribute;
- + if (i->attribute == 5)
- + WBUFB(buf,n+8)=0;
- + else
- + WBUFB(buf,n+8)=i->attribute;
- WBUFB(buf,n+9)=i->refine;
- } else { //Stackable item.
- WBUFW(buf,n+4)=i->amount;
- Index: src/map/map.c
- ===================================================================
- --- src/map/map.c (revision 14956)
- +++ src/map/map.c (working copy)
- @@ -1471,6 +1471,13 @@
- nullpo_retv(sd);
- + // Costume Item Name [GreenBox - Cronus]
- + if (charid == 0x7)
- + {
- + clif_solved_charname(sd->fd, charid, "Costume");
- + return;
- + }
- +
- tsd = map_charid2sd(charid);
- if( tsd )
- {
- Index: src/map/pc.c
- ===================================================================
- --- src/map/pc.c (revision 14956)
- +++ src/map/pc.c (working copy)
- @@ -59,7 +59,7 @@
- struct fame_list chemist_fame_list[MAX_FAME_LIST];
- struct fame_list taekwon_fame_list[MAX_FAME_LIST];
- -static unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_AMMO};
- +static unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_HEAD_TOP_C,EQP_HEAD_MID_C,EQP_HEAD_LOW_C,EQP_AMMO};
- #define MOTD_LINE_SIZE 128
- static char motd_text[MOTD_LINE_SIZE][CHAT_SIZE_MAX]; // Message of the day buffer [Valaris]
- @@ -516,6 +516,25 @@
- if(ep == EQP_HAND_R && (pc_checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN))
- return EQP_ARMS;
- }
- +
- + if (ep&EQP_HEAD_TOP && sd->status.inventory[n].attribute == 5)
- + {
- + ep &= ~EQP_HEAD_TOP;
- + ep |= EQP_HEAD_TOP_C;
- + }
- +
- + if (ep&EQP_HEAD_LOW && sd->status.inventory[n].attribute == 5)
- + {
- + ep &= ~EQP_HEAD_LOW;
- + ep |= EQP_HEAD_LOW_C;
- + }
- +
- + if (ep&EQP_HEAD_MID && sd->status.inventory[n].attribute == 5)
- + {
- + ep &= ~EQP_HEAD_MID;
- + ep |= EQP_HEAD_MID_C;
- + }
- +
- return ep;
- }
- @@ -753,6 +772,9 @@
- item = sd->inventory_data[n];
- + if ( sd->status.inventory[n].attribute == 5 )
- + return 1;
- +
- if( battle_config.gm_allequip>0 && pc_isGM(sd)>=battle_config.gm_allequip )
- return 1;
- @@ -7477,6 +7499,24 @@
- flag = id->range != sd->inventory_data[i]->range;
- }
- + if (pos&EQP_HEAD_TOP && sd->status.inventory[n].attribute == 5)
- + {
- + pos &= ~EQP_HEAD_TOP;
- + pos |= EQP_HEAD_TOP_C;
- + }
- +
- + if (pos&EQP_HEAD_LOW && sd->status.inventory[n].attribute == 5)
- + {
- + pos &= ~EQP_HEAD_LOW;
- + pos |= EQP_HEAD_LOW_C;
- + }
- +
- + if (pos&EQP_HEAD_MID && sd->status.inventory[n].attribute == 5)
- + {
- + pos &= ~EQP_HEAD_MID;
- + pos |= EQP_HEAD_MID_C;
- + }
- +
- for(i=0;i<EQI_MAX;i++) {
- if(pos & equip_pos[i]) {
- if(sd->equip_index[i] >= 0) //Slot taken, remove item from there.
- @@ -7538,11 +7578,35 @@
- }
- if(pos & EQP_HEAD_MID) {
- if(id && !(pos&EQP_HEAD_TOP))
- + sd->status.head_mid = id->look;
- + else
- + sd->status.head_mid = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
- + }
- +
- + // Costume Item System [GreenBox - Cronus]
- + if(pos & EQP_HEAD_LOW_C) {
- + if(id && !(pos&(EQP_HEAD_TOP_C|EQP_HEAD_MID_C)))
- + sd->status.head_bottom = id->look;
- + else
- + sd->status.head_bottom = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
- + }
- + if(pos & EQP_HEAD_TOP_C) {
- + if(id)
- + sd->status.head_top = id->look;
- + else
- + sd->status.head_top = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
- + }
- + if(pos & EQP_HEAD_MID_C) {
- + if(id && !(pos&EQP_HEAD_TOP_C))
- sd->status.head_mid = id->look;
- else
- sd->status.head_mid = 0;
- clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
- }
- +
- if(pos & EQP_SHOES)
- clif_changelook(&sd->bl,LOOK_SHOES,0);
- if( pos&EQP_GARMENT )
- @@ -7559,7 +7623,8 @@
- clif_skillinfoblock(sd);
- //OnEquip script [Skotlex]
- - if (id) {
- + // Costume Item Check [GreenBox - Cronus]
- + if (id && sd->status.inventory[n].attribute != 5) {
- int i;
- struct item_data *data;
- if (id->equip_script)
- @@ -7634,9 +7699,68 @@
- sd->status.head_top = 0;
- clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
- }
- - if(sd->status.inventory[n].equip & EQP_HEAD_MID) {
- - sd->status.head_mid = 0;
- - clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
- + if(sd->status.inventory[n].equip & EQP_HEAD_MID)
- + {
- + sd->status.head_mid = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
- + }
- +
- + // Costume Item System [GreenBox - Cronus]
- + if( sd->status.inventory[n].equip & EQP_HEAD_LOW && sd->equip_index[EQI_HEAD_LOW_C] == -1 )
- + {
- + if (sd->equip_index[EQI_HEAD_LOW] >= 0)
- + {
- + int d = sd->equip_index[EQI_HEAD_LOW];
- +
- + if(sd->inventory_data[d] && !(sd->inventory_data[d]->equip&(EQP_HEAD_TOP|EQP_HEAD_MID)))
- + sd->status.head_bottom = sd->inventory_data[d]->look;
- + else
- + sd->status.head_bottom = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
- + }
- + else
- + {
- + sd->status.head_bottom = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
- + }
- + }
- +
- + if( sd->status.inventory[n].equip & EQP_HEAD_TOP && sd->equip_index[EQI_HEAD_TOP_C] == -1 )
- + {
- + if (sd->equip_index[EQI_HEAD_TOP] >= 0)
- + {
- + int d = sd->equip_index[EQI_HEAD_TOP];
- +
- + if(sd->inventory_data[d])
- + sd->status.head_top = sd->inventory_data[d]->look;
- + else
- + sd->status.head_top = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
- + }
- + else
- + {
- + sd->status.head_top = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
- + }
- + }
- +
- + if( sd->status.inventory[n].equip & EQP_HEAD_MID && sd->equip_index[EQI_HEAD_MID_C] == -1 )
- + {
- + if (sd->equip_index[EQI_HEAD_MID] >= 0)
- + {
- + int d = sd->equip_index[EQI_HEAD_MID];
- +
- + if(sd->inventory_data[d] && !(sd->inventory_data[d]->equip&EQP_HEAD_TOP))
- + sd->status.head_mid = sd->inventory_data[d]->look;
- + else
- + sd->status.head_mid = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
- + }
- + else
- + {
- + sd->status.head_mid = 0;
- + clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
- + }
- }
- if(sd->status.inventory[n].equip & EQP_SHOES)
- clif_changelook(&sd->bl,LOOK_SHOES,0);
- @@ -7672,7 +7796,8 @@
- status_change_end(&sd->bl, SC_SIGNUMCRUCIS, INVALID_TIMER);
- //OnUnEquip script [Skotlex]
- - if (sd->inventory_data[n]) {
- + // Costume Item Check [GreenBox - Cronus]
- + if (sd->inventory_data[n] && sd->status.inventory[n].attribute != 5) {
- struct item_data *data;
- if (sd->inventory_data[n]->unequip_script)
- run_script(sd->inventory_data[n]->unequip_script,0,sd->bl.id,fake_nd->bl.id);
- Index: src/map/pc.h
- ===================================================================
- --- src/map/pc.h (revision 14956)
- +++ src/map/pc.h (working copy)
- @@ -161,7 +161,7 @@
- struct registry save_reg;
- struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
- - short equip_index[11];
- + short equip_index[14];
- unsigned int weight,max_weight;
- int cart_weight,cart_num;
- int fd;
- @@ -489,13 +489,16 @@
- EQP_GARMENT = 0x0004,
- EQP_ACC_L = 0x0008,
- EQP_ACC_R = 0x0080, //128
- + EQP_HEAD_TOP_C = 0x0400,
- + EQP_HEAD_MID_C = 0x0800,
- + EQP_HEAD_LOW_C = 0x1000,
- EQP_AMMO = 0x8000, //32768
- };
- #define EQP_WEAPON EQP_HAND_R
- #define EQP_SHIELD EQP_HAND_L
- #define EQP_ARMS (EQP_HAND_R|EQP_HAND_L)
- -#define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP)
- +#define EQP_HELM (EQP_HEAD_LOW|EQP_HEAD_MID|EQP_HEAD_TOP|EQP_HEAD_LOW_C|EQP_HEAD_MID_C|EQP_HEAD_TOP_C)
- #define EQP_ACC (EQP_ACC_L|EQP_ACC_R)
- /// Equip positions that use a visible sprite
- @@ -518,6 +521,9 @@
- EQI_ARMOR,
- EQI_HAND_L,
- EQI_HAND_R,
- + EQI_HEAD_TOP_C,
- + EQI_HEAD_MID_C,
- + EQI_HEAD_LOW_C,
- EQI_AMMO,
- EQI_MAX
- };
- Index: src/map/script.c
- ===================================================================
- --- src/map/script.c (revision 14956)
- +++ src/map/script.c (working copy)
- @@ -5567,6 +5567,109 @@
- return 0;
- }
- +// Costume Item System [GreenBox - Cronus]
- +BUILDIN_FUNC(getcostumeitem)
- +{
- + int nameid,amount,get_count,i,flag = 0;
- + struct item it;
- + TBL_PC *sd;
- + struct script_data *data;
- +
- + data=script_getdata(st,2);
- + get_val(st,data);
- + if( data_isstring(data) )
- + {// "<item name>"
- + const char *name=conv_str(st,data);
- + struct item_data *item_data = itemdb_searchname(name);
- + if( item_data == NULL ){
- + ShowError("buildin_getcostumeitem: Nonexistant item %s requested.\n", name);
- + return 1; //No item created.
- + }
- + nameid=item_data->nameid;
- + } else if( data_isint(data) )
- + {// <item id>
- + nameid=conv_num(st,data);
- + //Violet Box, Blue Box, etc - random item pick
- + if( nameid < 0 ) {
- + nameid=itemdb_searchrandomid(-nameid);
- + flag = 1;
- + }
- + if( nameid <= 0 || !itemdb_exists(nameid) ){
- + ShowError("buildin_getcostumeitem: Nonexistant item %d requested.\n", nameid);
- + return 1; //No item created.
- + }
- + } else {
- + ShowError("buildin_getcostumeitem: invalid data type for argument #1 (%d).", data->type);
- + return 1;
- + }
- +
- + // <amount>
- + if( (amount=script_getnum(st,3)) <= 0)
- + return 0; //return if amount <=0, skip the useles iteration
- +
- + memset(&it,0,sizeof(it));
- + it.nameid=nameid;
- + if(!flag)
- + it.identify=1;
- + else
- + it.identify=itemdb_isidentified(nameid);
- +
- + if (!(it.equip&EQP_HEAD_LOW) &&
- + !(it.equip&EQP_HEAD_LOW_C) &&
- + !(it.equip&EQP_HEAD_MID) &&
- + !(it.equip&EQP_HEAD_MID_C) &&
- + !(it.equip&EQP_HEAD_TOP) &&
- + !(it.equip&EQP_HEAD_TOP_C)
- + )
- + {
- + ShowError("buildin_getcostumeitem: this item can't be a costume.");
- + return 0;
- + }
- +
- + if( script_hasdata(st,4) )
- + sd=map_id2sd(script_getnum(st,4)); // <Account ID>
- + else
- + sd=script_rid2sd(st); // Attached player
- +
- + if( sd == NULL ) // no target
- + return 0;
- +
- + //Check if it's stackable.
- + if (!itemdb_isstackable(nameid))
- + get_count = 1;
- + else
- + get_count = amount;
- +
- + it.nameid=nameid;
- + it.identify=1;
- + it.refine=0;
- + it.attribute=5;
- + it.card[0]=0;
- + it.card[1]=0;
- + it.card[2]=0;
- + it.card[3]=0;
- +
- + for (i = 0; i < amount; i += get_count)
- + {
- + // if not pet egg
- + if (!pet_create_egg(sd, nameid))
- + {
- + if ((flag = pc_additem(sd, &it, get_count)))
- + {
- + clif_additem(sd, 0, 0, flag);
- + if( pc_candrop(sd,&it) )
- + map_addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
- + }
- + }
- + }
- +
- + //Logs items, got from (N)PC scripts [Lupus]
- + if(log_config.enable_logs&LOG_SCRIPT_TRANSACTIONS)
- + log_pick_pc(sd, "N", nameid, amount, NULL);
- +
- + return 0;
- +}
- +
- /*==========================================
- * getitem <item id>,<amount>{,<character ID>};
- * getitem "<item name>",<amount>{,<character ID>};
- @@ -10747,6 +10850,7 @@
- script_pushstr(st,item_name);
- return 0;
- }
- +
- /*==========================================
- * Returns number of slots an item has. [Skotlex]
- *------------------------------------------*/
- @@ -14970,6 +15074,7 @@
- BUILDIN_DEF(deletearray,"r?"),
- BUILDIN_DEF(getelementofarray,"ri"),
- BUILDIN_DEF(getitem,"vi?"),
- + BUILDIN_DEF(getcostumeitem,"vi?"),
- BUILDIN_DEF(rentitem,"vi"),
- BUILDIN_DEF(getitem2,"viiiiiiii?"),
- BUILDIN_DEF(getnameditem,"vv"),
- Index: src/map/status.c
- ===================================================================
- --- src/map/status.c (revision 14956)
- +++ src/map/status.c (working copy)
- @@ -1910,6 +1910,8 @@
- continue;
- if(!sd->inventory_data[index])
- continue;
- + if( sd->status.inventory[index].attribute == 5 ) // Costume Item Check [GreenBox - Cronus]
- + continue;
- status->def += sd->inventory_data[index]->def;
- Index: src/map/script.c
- ===================================================================
- --- src/map/script.c (revision 14956)
- +++ src/map/script.c (working copy)
- @@ -6684,3 +6684,3 @@
- for(i=0; i<MAX_INVENTORY; i++) {
- - if(sd->status.inventory[i].attribute){
- + if(sd->status.inventory[i].attribute && sd->status.inventory[i].attribute != 5){
- brokencounter++;
- @@ -6722,3 +6722,3 @@
- for(i=0; i<MAX_INVENTORY; i++) {
- - if(sd->status.inventory[i].attribute){
- + if(sd->status.inventory[i].attribute && sd->status.inventory[i].attribute != 5){
- repaircounter++;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement