EvilPuncker Posted May 3, 2012 Posted May 3, 2012 (edited) - add this "You can no longer set up purchase shops / vends within a 7x7 area around any NPC's." from 8/17/2011 kRO Maintenance Edited May 8, 2012 by EvilPuncker
xazax Posted May 7, 2012 Posted May 7, 2012 my bad then so I would like to bump with that one xD - add this "You can no longer set up purchase shops / vends within a 7x7 area around any NPC's." from 8/17/2011 kRO Maintenance Try this one. I could not test it, because I created this patch in my workplace, and I don't have a client here , hope it works. Index: conf/msg_athena.conf =================================================================== --- conf/msg_athena.conf (revision 16084) +++ conf/msg_athena.conf (working copy) @@ -531,7 +531,7 @@ 616: Taekwon 617: Star Gladiator 618: Soul Linker -//619: FREE +619: You can not open a shop close to an npc. //620: FREE 621: Summer 622: Gangsi Index: src/map/clif.c =================================================================== --- src/map/clif.c (revision 16084) +++ src/map/clif.c (working copy) @@ -11654,7 +11654,17 @@ sd->vended_id = 0; } +/// Function to check visible NPCs +static int check_npc_near_sub(struct block_list* bl, va_list args) +{ + TBL_NPC* nd = (TBL_NPC*)bl; + if( nd->sc.option&(OPTION_HIDE|OPTION_INVISIBLE) ) + return 0; + + return 1; +} + /// Confirm or cancel the shop preparation window. /// 012f <packet len>.W <shop name>.80B { <index>.W <amount>.W <price>.L }* (CZ_REQ_OPENSTORE) /// 01b2 <packet len>.W <shop name>.80B <result>.B { <index>.W <amount>.W <price>.L }* (CZ_REQ_OPENSTORE2) @@ -11674,6 +11684,10 @@ clif_displaymessage (sd->fd, msg_txt(276)); // "You can't open a shop on this map" return; } + if ( flag && map_foreachinrange(&check_npc_near_sub,&sd->bl, 3, BL_NPC) > 0) { + clif_displaymessage (sd->fd, msg_txt(619)); + return; + } if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) { clif_displaymessage (sd->fd, msg_txt(204)); // "You can't open a shop on this cell." return; 1
EvilPuncker Posted May 7, 2012 Author Posted May 7, 2012 (edited) @xazax works like a charm now it just need a battle conf added to features and then add to trunk @edit nvm, it broke the vending skill steps to reproduce: 1 - go near a npc and try to open your store 2 - get the 619 msg 3 - walk away from the npc range 4 - click ok to sell the same item 5 - get "You can't sell undentified items" 6 - the item disappears until logout Edited May 7, 2012 by EvilPuncker
xazax Posted May 7, 2012 Posted May 7, 2012 Strange. What happens, if you do a @refresh before step 4? And I wonder if there are some novending cells on the map if they have the same effect (they should). Maybe it is yet another issue with supporting "new" clients.
EvilPuncker Posted May 7, 2012 Author Posted May 7, 2012 then it works, seems like you have to close the vending after receiving the msg
xazax Posted May 7, 2012 Posted May 7, 2012 I wonder how the official servers hande this. Maybe they send ZC_OPENSTORE with negative or 0 number, which forces the client to close the window? Just a blind guess though, I hope somebody will make some packet capture on official servers
EvilPuncker Posted May 8, 2012 Author Posted May 8, 2012 btw it still triggers the msg even if you hit cancel instead of OK I've added a clif_refresh(sd); while there is no fix
Toshiro Posted May 8, 2012 Posted May 8, 2012 btw it still triggers the msg even if you hit cancel instead of OK I've added a clif_refresh(sd); while there is no fix That's probably not how it should be, but it's still useful if you don't want to count the cells - just use Vending, press cancel and see if you're already out of the restricted area.
xazax Posted May 9, 2012 Posted May 9, 2012 btw it still triggers the msg even if you hit cancel instead of OK I've added a clif_refresh(sd); while there is no fix I modified my diff, so it also checks flag (which should hold information about which button was pressed), now it should only trigger if one hit OK.
EvilPuncker Posted May 9, 2012 Author Posted May 9, 2012 btw it still triggers the msg even if you hit cancel instead of OK I've added a clif_refresh(sd); while there is no fix I modified my diff, so it also checks flag (which should hold information about which button was pressed), now it should only trigger if one hit OK. now its okay, but still the message from unidentified items :/ since the shop window still open, maybe that has something to do with vending.c?
Toshiro Posted May 9, 2012 Posted May 9, 2012 Official does not even shows you the vending window if you're in the range of an NPC and throws a message in the chatlog. Further you're unable to move while having the vending window open. Tested with the Buying Store item, but vending should be similar.
xazax Posted May 9, 2012 Posted May 9, 2012 This means, not just this patch, but also the current vending system needs some rework.
Toshiro Posted May 9, 2012 Posted May 9, 2012 Reply packet when trying to use the Buying Store item (is not consumed) when being in the restricted range of an NPC. 10 01 E7 09 00 00 00 00 00 53 clif_skill_fail(sd, ALL_BUYING_STORE, 83, 0);
Recommended Posts