Skip to content
Permalink
Browse files
Introducing the equip preview window
Fixes some bugs for 2016-09-21 onward, where you can preview how a item would like if you put it on.
This works on other people's vending and on your own inventory.

Thanks to @Rytech2 and @hazimjauhari90
  • Loading branch information
Lemongrass3110 committed May 8, 2017
1 parent 999c411 commit 9716233c842f731df3fed5281370e324b5f5f024
Showing with 40 additions and 13 deletions.
  1. +20 −3 src/map/clif.c
  2. +19 −10 src/map/pc.c
  3. +1 −0 src/map/pc.h
@@ -2508,6 +2508,7 @@ void clif_add_random_options(unsigned char* buf, struct item *it) {
/// 02d4 <index>.W <amount>.W <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.W <item type>.B <result>.B <expire time>.L <bindOnEquipType>.W (ZC_ITEM_PICKUP_ACK3)
/// 0990 <index>.W <amount>.W <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.L <item type>.B <result>.B <expire time>.L <bindOnEquipType>.W (ZC_ITEM_PICKUP_ACK_V5)
/// 0a0c <index>.W <amount>.W <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.L <item type>.B <result>.B <expire time>.L <bindOnEquipType>.W (ZC_ITEM_PICKUP_ACK_V6)
/// 0a37 <index>.W <amount>.W <name id>.W <identified>.B <damaged>.B <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W <equip location>.L <item type>.B <result>.B <expire time>.L <bindOnEquipType>.W <favorite>.B <view id>.W (ZC_ITEM_PICKUP_ACK_V7)
void clif_additem(struct map_session_data *sd, int n, int amount, unsigned char fail)
{
int fd, header, offs=0;
@@ -2519,8 +2520,10 @@ void clif_additem(struct map_session_data *sd, int n, int amount, unsigned char
header = 0x2d4;
#elif PACKETVER < 20150226
header = 0x990;
#else
#elif PACKETVER < 20160921
header = 0xa0c;
#else
header = 0xa37;
#endif
nullpo_retv(sd);

@@ -2557,6 +2560,10 @@ void clif_additem(struct map_session_data *sd, int n, int amount, unsigned char
WFIFOW(fd,offs+27) = 0; // HireExpireDate
#if PACKETVER >= 20150226
clif_add_random_options(WFIFOP(fd,offs+31), &sd->inventory.u.items_inventory[n]);
#if PACKETVER >= 20160921
WFIFOB(fd,offs+54) = 0; // Favorite
WFIFOW(fd,offs+55) = 0; // View ID
#endif
#endif
#endif
}
@@ -2593,6 +2600,10 @@ void clif_additem(struct map_session_data *sd, int n, int amount, unsigned char
#endif
#if PACKETVER >= 20150226
clif_add_random_options(WFIFOP(fd,31), &sd->inventory.u.items_inventory[n]);
#if PACKETVER >= 20160921
WFIFOB(fd,offs+54) = sd->inventory.u.items_inventory[n].favorite;
WFIFOW(fd,offs+55) = sd->inventory_data[n]->view_id > 0 ? sd->inventory_data[n]->view_id : sd->inventory_data[n]->nameid;
#endif
#endif
}

@@ -7104,8 +7115,10 @@ void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* ven

#if PACKETVER < 20150226
const int item_length = 22;
#else
#elif PACKETVER < 20160921
const int item_length = 47;
#else
const int item_length = 53;
#endif

nullpo_retv(sd);
@@ -7138,6 +7151,10 @@ void clif_vendinglist(struct map_session_data* sd, int id, struct s_vending* ven
clif_addcards(WFIFOP(fd,offset+14+i*item_length), &vsd->cart.u.items_cart[index]);
#if PACKETVER >= 20150226
clif_add_random_options(WFIFOP(fd,offset+22+i*item_length), &vsd->cart.u.items_cart[index]);
#if PACKETVER >= 20160921
WFIFOL(fd,offset+47+i*item_length) = pc_equippoint_sub(sd,data);
WFIFOW(fd,offset+51+i*item_length) = data->view_id > 0 ? data->view_id : data->nameid;
#endif
#endif
}
WFIFOSET(fd,WFIFOW(fd,2));
@@ -19542,7 +19559,7 @@ void packetdb_readdb(bool reload)
#endif
-1, 0, 0, 26, 0, 0, 0, 0, 14, 2, 23, 2, -1, 2, 3, 2,
21, 3, 5, 0, 66, 0, 0, 8, 3, 0, 0, -1, 0, -1, 0, 0,
106, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106, 0, 0, 0, 0, 4, 0, 59, 0, 0, 0, 0, 0, 0, 0, 0,
};
struct {
void (*func)(int, struct map_session_data *);
@@ -662,30 +662,39 @@ void pc_setnewpc(struct map_session_data *sd, uint32 account_id, uint32 char_id,
/**
* Get equip point for an equip
* @param sd
* @param n Equip index in inventory
* @param id
*/
int pc_equippoint(struct map_session_data *sd,int n){
int pc_equippoint_sub(struct map_session_data *sd,struct item_data* id){
int ep = 0;

nullpo_ret(sd);
nullpo_ret(id);

if(!sd->inventory_data[n])
return 0;

if (!itemdb_isequip2(sd->inventory_data[n]))
if (!itemdb_isequip2(id))
return 0; //Not equippable by players.

ep = sd->inventory_data[n]->equip;
if(sd->inventory_data[n]->look == W_DAGGER ||
sd->inventory_data[n]->look == W_1HSWORD ||
sd->inventory_data[n]->look == W_1HAXE) {
ep = id->equip;
if(id->look == W_DAGGER ||
id->look == W_1HSWORD ||
id->look == W_1HAXE) {
if(ep == EQP_HAND_R && (pc_checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN ||
(sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO))//Kagerou and Oboro can dual wield daggers. [Rytech]
return EQP_ARMS;
}
return ep;
}

/**
* Get equip point for an equip
* @param sd
* @param n Equip index in inventory
*/
int pc_equippoint(struct map_session_data *sd,int n){
nullpo_ret(sd);

return pc_equippoint_sub(sd,sd->inventory_data[n]);
}

/**
* Fill inventory_data with struct *item_data through inventory (fill with struct *item)
* @param sd : player session
@@ -986,6 +986,7 @@ int pc_close_npc_timer(int tid, unsigned int tick, int id, intptr_t data);
void pc_setequipindex(struct map_session_data *sd);
uint8 pc_isequip(struct map_session_data *sd,int n);
int pc_equippoint(struct map_session_data *sd,int n);
int pc_equippoint_sub(struct map_session_data *sd, struct item_data* id);
void pc_setinventorydata(struct map_session_data *sd);

int pc_get_skillcooldown(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);

16 comments on commit 9716233

@Mikegyver
Copy link
Contributor

@Mikegyver Mikegyver commented on 9716233 May 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it comes.. thank you so much @Lemongrass3110 for this.. thumb up for this commit..

@admkakaroto
Copy link
Contributor

@admkakaroto admkakaroto commented on 9716233 May 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option to view the items appears, but does not work, from the crash on the client whenever I try to view the items, client 2016-12-28!

@Lemongrass3110
Copy link
Member Author

@Lemongrass3110 Lemongrass3110 commented on 9716233 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What error did you get? At first I had missing textures as well and it crashed my client. And additionally some lua files were also outdated. Make sure you use the correct ones and have every file you need.

@admkakaroto
Copy link
Contributor

@admkakaroto admkakaroto commented on 9716233 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Equip Preview system works perfectly, but when I go to view the items in the vending stores, the client crash, look:

Normal: http://imgur.com/bNDaYvi

Vending: http://imgur.com/8HrY4Y8

Edit: I will update my files only by warranty.

@Mikegyver
Copy link
Contributor

@Mikegyver Mikegyver commented on 9716233 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my client won't crash. however it just the headgear is not previewed it heagear preview window. see the screenshot below.

screen1asiaro034

@admkakaroto
Copy link
Contributor

@admkakaroto admkakaroto commented on 9716233 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's probably my files, I'll update, sorry!

@anacondaq
Copy link

@anacondaq anacondaq commented on 9716233 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, Are there any who have the client & files what possible to use to touch the system? Will be about the system topic at board?

@Mikegyver
Copy link
Contributor

@Mikegyver Mikegyver commented on 9716233 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is touch system anyway @Anacondaqq?

@Lemongrass3110
Copy link
Member Author

@Lemongrass3110 Lemongrass3110 commented on 9716233 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The client for this is not yet officially supported. I just felt like adding some of the new packets.
Once it is supported there will be a board announcement for sure!

@admkakaroto
Copy link
Contributor

@admkakaroto admkakaroto commented on 9716233 May 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lemongrass3110 @hazimjauhari90
I tested with Novice class and did not crash, however the item also did not appear when I get a 3rd class, the client crash.

http://imgur.com/ij5yIw2

@Mikegyver
Copy link
Contributor

@Mikegyver Mikegyver commented on 9716233 May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@admkakaroto i don't having that crashing issue on 3rd job class.. here's the screenshot.. but, for the item not appear on preview window, that issue i alredy mention at previous comment above.

screen1asiaro039

@admkakaroto
Copy link
Contributor

@admkakaroto admkakaroto commented on 9716233 May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change the class using the command actually you do not crash and the item does not appear, to reproduce the problem follow the steps:

  1. Turn your character into 3rd class, @job 4065.
  2. Turn off the server.
  3. Open the server and try to view some item in some vending store.

@Mikegyver
Copy link
Contributor

@Mikegyver Mikegyver commented on 9716233 May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@admkakaroto do these steps are correct:

  1. create the vending store then make the char into autotrade mode (@'autotrade')
  2. restart the server (./athena-start restart)
  3. try to preview some headgear in vending store

@Lemongrass3110
Copy link
Member Author

@Lemongrass3110 Lemongrass3110 commented on 9716233 May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed in 55735ea

@admkakaroto
Copy link
Contributor

@admkakaroto admkakaroto commented on 9716233 May 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lemongrass3110 Nice! Work Perfect!

@Mikegyver
Copy link
Contributor

@Mikegyver Mikegyver commented on 9716233 May 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lemongrass3110 nice! good job! and a big thank you ^^

Please sign in to comment.