Jump to content
  • 0

What wrong on this sources


Jayz

Question


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

Hello.. i have source mod by epoque this project no longer support by epoque so i decide update everything my problem is addslot doesnt work with the getitemslots script command

/*==========================================
// Epoque's Expansion Pack
* addslot <position>;
*------------------------------------------*/
BUILDIN_FUNC(addslot)
{
int i, j;
int slot, flag;
struct item equip_;
struct map_session_data* sd = script_rid2sd(st);
const int pos[] = { EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW };

if (sd == NULL)
{
	ShowError("addslot: Failed to add slot, no player attached!\n");
	return 0;
}

slot = script_getnum(st, 2);

if (slot < EQI_ACC_L || slot > EQI_HAND_R )
{
	ShowError("addslot: Invalid equipment given (%d), can only slot equipment.\n", slot);
	return 0;
}

slot = sd->equip_index[pos[slot - 1]];

if (slot < 0)
{
	ShowError("addslot: No equipment slotted at the given position\n");
	return 0;
}
if (itemdb_isspecial(sd->status.inventory[slot].card[0]) ||
	sd->inventory_data[slot]->slot == MAX_SLOTS ||
	sd->status.inventory[slot].card[3] > CARD_NOSLOT_ID)
{
	ShowError("addslot: This equipment already has full slots/all available slots.");
	return 0;
}

/* Search for a previously removed slot */
ARR_FIND(0, sd->inventory_data[slot]->slot, i, sd->status.inventory[slot].card[i] == CARD_NOSLOT_ID);

if (i == sd->inventory_data[slot]->slot)
{
	/* Search for a free card block */
	ARR_FIND(0, MAX_SLOTS, i, sd->status.inventory[slot].card[i] == 0 && i >= sd->inventory_data[slot]->slot);
}

if (i == MAX_SLOTS)
{
	ShowError("addslot: This equipment has no available slots.\n");
	return 0;
}

equip_.id = 0;
equip_.nameid = sd->inventory_data[slot]->nameid;
equip_.amount = 1;
equip_.equip = 0;
equip_.identify = 1;
equip_.refine = sd->status.inventory[slot].refine;
equip_.attribute = sd->status.inventory[slot].attribute;
equip_.expire_time = sd->status.inventory[slot].expire_time;

for (j = 0; MAX_SLOTS > j; j++)
	equip_.card[j] = sd->status.inventory[slot].card[j];

if (i < sd->inventory_data[slot]->slot)
	equip_.card[i] = 0;
else
	equip_.card[i] = CARD_SLOT_ID;

pc_delitem(sd,slot,1,0,0,LOG_TYPE_SCRIPT);

if((flag = pc_additem(sd, &equip_, 1,LOG_TYPE_SCRIPT)))
{
	clif_additem(sd, 0, 0, flag);
	map_addflooritem(&equip_,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
}

return 0;
}

bump

Edited by Zack-
Link to comment
Share on other sites

12 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

bump,,,, anyone know this?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

up

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

up

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

please post here what is the error.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

doesnt work with the getitemslots script command

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I don't know where the original topic is

but a wild guess from me what this snippet does is

add an item slot only to a single player <-- cause it need player attached

but the getitemslot script command is search into itemdb database

so the snippet provide there has no problem with it

but you probably need another custom made script command like *getitemslot2 to purposely fulfill this condition <-- EDITED

I had a hunch thinking that *getinventorylist might do the trick

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

I don't know where the original topic is

but a wild guess from me what this snippet does is

add an item slot only to a single player <-- cause it need player attached

but the getitemslot script command is search into itemdb database

so the snippet provide there has no problem with it

but you probably need another custom made script command like *getitemslot2 to purposely fulfill this condition <-- EDITED

I had a hunch thinking that *getinventorylist might do the trick

This is the original topic http://www.eathena.ws/board/index.php?showtopic=244783

and this is my same problem => http://www.eathena.ws/board/index.php?showtopic=244783&view=findpost&p=1343539

and epoque reply => http://www.eathena.ws/board/index.php?showtopic=244783&view=findpost&p=1343574

untill the project is dead so the getitemslots script command didnot fix

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

on one of the post on eathena

addslot doesnt work with the getitemslots script command or am i doing it wrong? heres how i am checking it if(getitemslots(EQI_HEAD_TOP)==1)

replace

if ( getitemslot( EQI_HEAD_TOP ) == 1 ) { < statement > }

into

getinventorylist;
for ( set .@i, 0; .@i < @inventorylist_count; set .@i, .@i +1 ) {
if ( @inventorylist_equip[.@i] == 256 ) {
< statement >
}
}

EdIted

Loc: Equipment's placement. Values are:

2^8 256 = Upper Headgear

========================

EDITED 2:

OK screwed it up

getinventorylist doesn't check the amount of slots that item has

it can only check AFTER the player has inserted the card though

so ... nope, still need a serious *getitemslot2 ....

work around adding @inventorylist_slots in *getinventorylist script command sound possible but isn't practical at all

as the command was needed in item database script

Edited by AnnieRuru
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

i want to impliment getitemslot2 but i don't know how to code that to compatible in addslot by epoque :( can you help me?

Edited by Zack-
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

got a PM to write this...

BUILDIN_FUNC(getitemslotspc) {
TBL_PC* sd = script_rid2sd(st);
int pos = script_getnum( st, 2 ), i;
if ( sd == NULL )
	return 0;
if ( pos < 0 || pos >= ARRAYLENGTH(equip) ) {
	script_pushint(st,-1);
	return 0;
}
i = pc_checkequip( sd, equip[pos -1] );
if ( i < 0 )
	script_pushint( st, -1 );
else
	script_pushint( st, sd->inventory_data[i]->slot );
return 0;
}

BUILDIN_DEF(getitemslotspc,"i"),

what a joke, 2 hours to tackle this <.<

*getitemslotspc( <equip slot> );

return the amount of slot from equipment

if return -1 means that equip position is not equipped

dispbottom getitemslotspc(EQI_HEAD_TOP)+""; // show the amount of slots available on top headgear

Edited by AnnieRuru
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  59
  • Topics Per Day:  0.01
  • Content Count:  396
  • Reputation:   53
  • Joined:  07/24/12
  • Last Seen:  

oh thanks annie ill try then ill send reply for the result

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  58
  • Reputation:   5
  • Joined:  12/12/11
  • Last Seen:  

Annie,is not work(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...