diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-12 21:14:28 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-12 21:14:28 +0000 |
commit | 3c9a4b95c3612e0925baf1b116460e0c07cd6d2f (patch) | |
tree | e958d75a53e32c98f8c67550e81b781a96c97cf8 /src/map | |
parent | 05d3b8fa90b371b23db1b934945837276b3ab545 (diff) | |
download | hercules-3c9a4b95c3612e0925baf1b116460e0c07cd6d2f.tar.gz hercules-3c9a4b95c3612e0925baf1b116460e0c07cd6d2f.tar.bz2 hercules-3c9a4b95c3612e0925baf1b116460e0c07cd6d2f.tar.xz hercules-3c9a4b95c3612e0925baf1b116460e0c07cd6d2f.zip |
- Fixed npc_checknear's distance check returning the opposite of what it should (false when the range is correct and viceversa)
- SL_STIN/SL_STUN have dex-reducable casting times now.
- Added a warning on item loading when an item is of equippable type but has no equippable position.
- Turning an alliance to an opposition won't work now during WoE
- Slaves can summon other mobs now. The only ones who can't do this are player summoned mobs.
- Merged the following functions for faster processing of items:
clif_storageitemlist + clif_storageequiplist = clif_storagelist
clif_guildstorageitemlist + clif_guildstorageequiplist = clif_guildstoragelist
clif_itemlist + clif_equiplist = clif_inventorylist
- Increased max knockback value support to 25.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7109 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 4 | ||||
-rw-r--r-- | src/map/clif.c | 586 | ||||
-rw-r--r-- | src/map/clif.h | 13 | ||||
-rw-r--r-- | src/map/guild.c | 7 | ||||
-rw-r--r-- | src/map/intif.c | 6 | ||||
-rw-r--r-- | src/map/itemdb.c | 39 | ||||
-rw-r--r-- | src/map/npc.c | 4 | ||||
-rw-r--r-- | src/map/path.c | 6 | ||||
-rw-r--r-- | src/map/pc.c | 7 | ||||
-rw-r--r-- | src/map/storage.c | 6 | ||||
-rw-r--r-- | src/map/unit.c | 2 |
11 files changed, 254 insertions, 426 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 6cef53b59..168f6cb62 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2200,9 +2200,7 @@ int atcommand_option( sd->sc.opt1 = param1;
sd->sc.opt2 = param2;
if (!(sd->sc.option & CART_MASK) && param3 & CART_MASK) {
- if (sd->status.class_ == JOB_BABY_MERCHANT)
- clif_cart_itemlist(sd);
- clif_cart_equiplist(sd);
+ clif_cartlist(sd);
clif_updatestatus(sd, SP_CARTINFO);
}
pc_setoption(sd, param3);
diff --git a/src/map/clif.c b/src/map/clif.c index 16714e21b..226c4c713 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2134,341 +2134,263 @@ int clif_delitem(struct map_session_data *sd,int n,int amount) return 0;
}
-/*==========================================
- *
- *------------------------------------------
- */
-int clif_itemlist(struct map_session_data *sd)
+// Simplifies inventory/cart/storage packets by handling the packet section relevant to items. [Skotlex]
+// Equip is > 0 for equippable items (holds the equip-point)
+// 0 for stackable items, -1 for stackable items where arrows must send in the equip-point.
+void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data *id, int equip)
{
- int i,n,fd,arrow=-1;
- unsigned char *buf;
+ if (id->view_id > 0)
+ WBUFW(buf,n)=id->view_id;
+ else
+ WBUFW(buf,n)=i->nameid;
+ WBUFB(buf,n+2)=itemtype(id->type);
+ WBUFB(buf,n+3)=i->identify;
+ if (equip > 0) { //Equippable item.
+ WBUFW(buf,n+4)=equip;
+ WBUFW(buf,n+6)=i->equip;
+ WBUFB(buf,n+8)=i->attribute;
+ WBUFB(buf,n+9)=i->refine;
+ } else { //Stackable item.
+ WBUFW(buf,n+4)=i->amount;
+ if (equip == -1 && id->equip == 0x8000)
+ WBUFW(buf,n+6)=0x8000;
+ else
+ WBUFW(buf,n+6)=0;
+ }
- nullpo_retr(0, sd);
+}
- fd=sd->fd;
- WFIFOHEAD(fd, MAX_INVENTORY * 10 + 4);
- buf = WFIFOP(fd,0);
+//Unified inventory function which sends all of the inventory (requires two packets, one for equipable items and one for stackable ones. [Skotlex]
+void clif_inventorylist(struct map_session_data *sd)
+{
+ int i,n,ne,fd = sd->fd,arrow=-1;
+ unsigned char *buf;
+ unsigned char bufe[MAX_INVENTORY*20+4];
#if PACKETVER < 5
- WBUFW(buf,0)=0xa3;
- for(i=0,n=0;i<MAX_INVENTORY;i++){
- if (sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL || itemdb_isequip2(sd->inventory_data[i]))
- continue;
- WBUFW(buf,n*10+4)=i+2;
- if (sd->inventory_data[i]->view_id > 0)
- WBUFW(buf,n*10+6)=sd->inventory_data[i]->view_id;
- else
- WBUFW(buf,n*10+6)=sd->status.inventory[i].nameid;
- WBUFB(buf,n*10+8)=itemtype(sd->inventory_data[i]->type);
- WBUFB(buf,n*10+9)=sd->status.inventory[i].identify;
- WBUFW(buf,n*10+10)=sd->status.inventory[i].amount;
- if (sd->inventory_data[i]->equip == 0x8000) {
- WBUFW(buf,n*10+12)=0x8000;
- if (sd->status.inventory[i].equip)
- arrow=i; // ついでに矢装備チェック
- } else
- WBUFW(buf,n*10+12)=0;
- n++;
- }
- if (n) {
- WBUFW(buf,2)=4+n*10;
- WFIFOSET(fd,WFIFOW(fd,2));
- }
+ const int s = 10; //Entry size.
#else
- WBUFW(buf,0)=0x1ee;
- for(i=0,n=0;i<MAX_INVENTORY;i++){
- if(sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL || itemdb_isequip2(sd->inventory_data[i]))
- continue;
- WBUFW(buf,n*18+4)=i+2;
- if(sd->inventory_data[i]->view_id > 0)
- WBUFW(buf,n*18+6)=sd->inventory_data[i]->view_id;
- else
- WBUFW(buf,n*18+6)=sd->status.inventory[i].nameid;
- WBUFB(buf,n*18+8)=itemtype(sd->inventory_data[i]->type);
- WBUFB(buf,n*18+9)=sd->status.inventory[i].identify;
- WBUFW(buf,n*18+10)=sd->status.inventory[i].amount;
- if (sd->inventory_data[i]->equip == 0x8000) {
- WBUFW(buf,n*18+12)=0x8000;
- if(sd->status.inventory[i].equip)
- arrow=i; // ついでに矢装備チェック
- } else
- WBUFW(buf,n*18+12)=0;
- clif_addcards(WBUFP(buf, n*18+14), &sd->status.inventory[i]);
- n++;
+ const int s = 18;
+#endif
+ WFIFOHEAD(fd, MAX_INVENTORY * s + 4);
+ buf = WFIFOP(fd,0);
+
+ for(i=0,n=0,ne=0;i<MAX_INVENTORY;i++){
+ if (sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL)
+ continue;
+
+ if(itemdb_isequip2(sd->inventory_data[i]))
+ { //Equippable
+ WBUFW(bufe,ne*20+4)=i+2;
+ clif_item_sub(bufe, ne*20+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i));
+ clif_addcards(WBUFP(bufe, ne*20+16), &sd->status.inventory[i]);
+ ne++;
+ } else { //Stackable.
+ WBUFW(buf,n*s+4)=i+2;
+ clif_item_sub(buf, n*s+6, &sd->status.inventory[i], sd->inventory_data[i], -1);
+ if (sd->inventory_data[i]->equip == 0x8000 &&
+ sd->status.inventory[i].equip)
+ arrow=i;
+#if PACKETVER >= 5
+ clif_addcards(WBUFP(buf, n*s+14), &sd->status.inventory[i]);
+#endif
+ n++;
+ }
}
if (n) {
- WBUFW(buf,2)=4+n*18;
+#if PACKETVER < 5
+ WBUFW(buf,0)=0xa3;
+#else
+ WBUFW(buf,0)=0x1ee;
+#endif
+ WBUFW(buf,2)=4+n*s;
WFIFOSET(fd,WFIFOW(fd,2));
}
-#endif
if(arrow >= 0)
clif_arrowequip(sd,arrow);
- return 0;
-}
-/*==========================================
- *
- *------------------------------------------
- */
-int clif_equiplist(struct map_session_data *sd)
-{
- int i,n,fd;
-
- nullpo_retr(0, sd);
-
- fd=sd->fd;
- if (!session_isActive(fd))
- return 0;
- WFIFOHEAD(fd, 4 + MAX_INVENTORY * 20);
- WFIFOW(fd,0)=0xa4;
- for(i=0,n=0;i<MAX_INVENTORY;i++){
- if(sd->status.inventory[i].nameid<=0 || sd->inventory_data[i] == NULL || !itemdb_isequip2(sd->inventory_data[i]))
- continue;
- WFIFOW(fd,n*20+4)=i+2;
- if(sd->inventory_data[i]->view_id > 0)
- WFIFOW(fd,n*20+6)=sd->inventory_data[i]->view_id;
- else
- WFIFOW(fd,n*20+6)=sd->status.inventory[i].nameid;
- WFIFOB(fd,n*20+8)=itemtype(sd->inventory_data[i]->type);
- WFIFOB(fd,n*20+9)=sd->status.inventory[i].identify;
- WFIFOW(fd,n*20+10)=pc_equippoint(sd,i);
- WFIFOW(fd,n*20+12)=sd->status.inventory[i].equip;
- WFIFOB(fd,n*20+14)=sd->status.inventory[i].attribute;
- WFIFOB(fd,n*20+15)=sd->status.inventory[i].refine;
- clif_addcards(WFIFOP(fd, n*20+16), &sd->status.inventory[i]);
- n++;
+ if(ne){
+ WBUFW(bufe,0)=0xa4;
+ WBUFW(bufe,2)=4+ne*20;
+ clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
}
- if(n){
- WFIFOW(fd,2)=4+n*20;
- WFIFOSET(fd,WFIFOW(fd,2));
- }
- return 0;
+
}
-/*==========================================
- * カプラさんに預けてある消耗品&収集品リスト
- *------------------------------------------
- */
-int clif_storageitemlist(struct map_session_data *sd,struct storage *stor)
+//Required when items break/get-repaired. Only sends equippable item list.
+void clif_equiplist(struct map_session_data *sd)
{
- struct item_data *id;
- int i,n,fd;
+ int i,n,fd = sd->fd;
unsigned char *buf;
-
- nullpo_retr(0, sd);
- nullpo_retr(0, stor);
-
- fd=sd->fd;
- WFIFOHEAD(fd,MAX_STORAGE * 18 + 4);
+ WFIFOHEAD(fd, MAX_INVENTORY * 20 + 4);
buf = WFIFOP(fd,0);
-#if PACKETVER < 5
- WBUFW(buf,0)=0xa5;
- for(i=0,n=0;i<MAX_STORAGE;i++){
- if(stor->storage_[i].nameid<=0)
- continue;
- nullpo_retr(0, id = itemdb_search(stor->storage_[i].nameid));
- if(itemdb_isequip2(id))
- continue;
-
- WBUFW(buf,n*10+4)=i+1;
- if(id->view_id > 0)
- WBUFW(buf,n*10+6)=id->view_id;
- else
- WBUFW(buf,n*10+6)=stor->storage_[i].nameid;
- WBUFB(buf,n*10+8)=itemtype(id->type);
- WBUFB(buf,n*10+9)=stor->storage_[i].identify;
- WBUFW(buf,n*10+10)=stor->storage_[i].amount;
- WBUFW(buf,n*10+12)=0;
- n++;
- }
- if(n){
- WBUFW(buf,2)=4+n*10;
- WFIFOSET(fd,WFIFOW(fd,2));
- }
-#else
- WBUFW(buf,0)=0x1f0;
- for(i=0,n=0;i<MAX_STORAGE;i++){
- if(stor->storage_[i].nameid<=0)
- continue;
- nullpo_retr(0, id = itemdb_search(stor->storage_[i].nameid));
- if(itemdb_isequip2(id))
+
+ for(i=0,n=0;i<MAX_INVENTORY;i++){
+ if (sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL)
+ continue;
+
+ if(!itemdb_isequip2(sd->inventory_data[i]))
continue;
-
- WBUFW(buf,n*18+4)=i+1;
- if(id->view_id > 0)
- WBUFW(buf,n*18+6)=id->view_id;
- else
- WBUFW(buf,n*18+6)=stor->storage_[i].nameid;
- WBUFB(buf,n*18+8)=itemtype(id->type);
- WBUFB(buf,n*18+9)=stor->storage_[i].identify;
- WBUFW(buf,n*18+10)=stor->storage_[i].amount;
- WBUFW(buf,n*18+12)=0;
- clif_addcards(WBUFP(buf,n*18+14), &stor->storage_[i]);
+ //Equippable
+ WBUFW(buf,n*20+4)=i+2;
+ clif_item_sub(buf, n*20+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i));
+ clif_addcards(WBUFP(buf, n*20+16), &sd->status.inventory[i]);
n++;
}
- if(n){
- WBUFW(buf,2)=4+n*18;
+ if (n) {
+ WBUFW(buf,0)=0xa4;
+ WBUFW(buf,2)=4+n*20;
WFIFOSET(fd,WFIFOW(fd,2));
}
-#endif
- return 0;
}
-/*==========================================
- * カプラさんに預けてある装備リスト
- *------------------------------------------
- */
-int clif_storageequiplist(struct map_session_data *sd,struct storage *stor)
+//Unified storage function which sends all of the storage (requires two packets, one for equipable items and one for stackable ones. [Skotlex]
+void clif_storagelist(struct map_session_data *sd,struct storage *stor)
{
struct item_data *id;
- int i,n,fd;
+ int i,n,ne,fd=sd->fd;
unsigned char *buf;
-
- nullpo_retr(0, sd);
- nullpo_retr(0, stor);
-
- fd=sd->fd;
- WFIFOHEAD(fd,MAX_STORAGE * 20 + 4);
+ unsigned char bufe[MAX_STORAGE*20+4];
+#if PACKETVER < 5
+ const int s = 10; //Entry size.
+#else
+ const int s = 18;
+#endif
+ WFIFOHEAD(fd,MAX_STORAGE * s + 4);
buf = WFIFOP(fd,0);
- WBUFW(buf,0)=0xa6;
+
for(i=0,n=0;i<MAX_STORAGE;i++){
if(stor->storage_[i].nameid<=0)
continue;
- nullpo_retr(0, id = itemdb_search(stor->storage_[i].nameid));
- if(!itemdb_isequip2(id))
- continue;
- WBUFW(buf,n*20+4)=i+1;
- if(id->view_id > 0)
- WBUFW(buf,n*20+6)=id->view_id;
- else
- WBUFW(buf,n*20+6)=stor->storage_[i].nameid;
- WBUFB(buf,n*20+8)=itemtype(id->type);
- WBUFB(buf,n*20+9)=stor->storage_[i].identify;
- WBUFW(buf,n*20+10)=id->equip;
- WBUFW(buf,n*20+12)=stor->storage_[i].equip;
- WBUFB(buf,n*20+14)=stor->storage_[i].attribute;
- WBUFB(buf,n*20+15)=stor->storage_[i].refine;
- clif_addcards(WBUFP(buf, n*20+16), &stor->storage_[i]);
- n++;
+ id = itemdb_search(stor->storage_[i].nameid);
+ if(itemdb_isequip2(id))
+ { //Equippable
+ WBUFW(bufe,ne*20+4)=i+1;
+ clif_item_sub(bufe, ne*20+6, &stor->storage_[i], id, id->equip);
+ clif_addcards(WBUFP(bufe, ne*20+16), &stor->storage_[i]);
+ ne++;
+ } else { //Stackable
+ WBUFW(buf,n*s+4)=i+1;
+ clif_item_sub(buf, n*s+6, &stor->storage_[i], id, 0);
+#if PACKETVER >= 5
+ clif_addcards(WBUFP(buf,n*s+14), &stor->storage_[i]);
+#endif
+ n++;
+ }
}
if(n){
- WBUFW(buf,2)=4+n*20;
+#if PACKETVER < 5
+ WBUFW(buf,0)=0xa5;
+#else
+ WBUFW(buf,0)=0x1f0;
+#endif
+ WBUFW(buf,2)=4+n*s;
WFIFOSET(fd,WFIFOW(fd,2));
}
- return 0;
+ if(ne){
+ WBUFW(bufe,0)=0xa6;
+ WBUFW(bufe,2)=4+ne*20;
+ clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
+ }
}
-/*==========================================
- *
- *------------------------------------------
- */
-int clif_guildstorageitemlist(struct map_session_data *sd,struct guild_storage *stor)
+//Unified storage function which sends all of the storage (requires two packets, one for equipable items and one for stackable ones. [Skotlex]
+void clif_guildstoragelist(struct map_session_data *sd,struct guild_storage *stor)
{
struct item_data *id;
- int i,n,fd;
+ int i,n,ne,fd=sd->fd;
unsigned char *buf;
-
- nullpo_retr(0, sd);
- nullpo_retr(0, stor);
-
- fd=sd->fd;
- WFIFOHEAD(fd, MAX_GUILD_STORAGE * 18 + 4);
- buf=WFIFOP(fd,0);
-
+ unsigned char bufe[MAX_GUILD_STORAGE*20+4];
#if PACKETVER < 5
- WBUFW(buf,0)=0xa5;
- for(i=0,n=0;i<MAX_GUILD_STORAGE;i++){
- if(stor->storage_[i].nameid<=0)
- continue;
- nullpo_retr(0, id = itemdb_search(stor->storage_[i].nameid));
- if(itemdb_isequip2(id))
- continue;
-
- WBUFW(buf,n*10+4)=i+1;
- if(id->view_id > 0)
- WBUFW(buf,n*10+6)=id->view_id;
- else
- WBUFW(buf,n*10+6)=stor->storage_[i].nameid;
- WBUFB(buf,n*10+8)=itemtype(id->type);
- WBUFB(buf,n*10+9)=stor->storage_[i].identify;
- WBUFW(buf,n*10+10)=stor->storage_[i].amount;
- WBUFW(buf,n*10+12)=0;
- n++;
- }
- if(n){
- WBUFW(buf,2)=4+n*10;
- WFIFOSET(fd,WFIFOW(fd,2));
- }
+ const int s = 10; //Entry size.
#else
- WBUFW(buf,0)=0x1f0;
+ const int s = 18;
+#endif
+ WFIFOHEAD(fd,MAX_GUILD_STORAGE * s + 4);
+ buf = WFIFOP(fd,0);
+
for(i=0,n=0;i<MAX_GUILD_STORAGE;i++){
if(stor->storage_[i].nameid<=0)
continue;
- nullpo_retr(0, id = itemdb_search(stor->storage_[i].nameid));
+ id = itemdb_search(stor->storage_[i].nameid);
if(itemdb_isequip2(id))
- continue;
-
- WBUFW(buf,n*18+4)=i+1;
- if(id->view_id > 0)
- WBUFW(buf,n*18+6)=id->view_id;
- else
- WBUFW(buf,n*18+6)=stor->storage_[i].nameid;
- WBUFB(buf,n*18+8)=itemtype(id->type);
- WBUFB(buf,n*18+9)=stor->storage_[i].identify;
- WBUFW(buf,n*18+10)=stor->storage_[i].amount;
- WBUFW(buf,n*18+12)=0;
- clif_addcards(WBUFP(buf,n*18+14), &stor->storage_[i]);
- n++;
+ { //Equippable
+ WBUFW(bufe,ne*20+4)=i+1;
+ clif_item_sub(bufe, ne*20+6, &stor->storage_[i], id, id->equip);
+ clif_addcards(WBUFP(bufe, ne*20+16), &stor->storage_[i]);
+ ne++;
+ } else { //Stackable
+ WBUFW(buf,n*s+4)=i+1;
+ clif_item_sub(buf, n*s+6, &stor->storage_[i], id, 0);
+#if PACKETVER >= 5
+ clif_addcards(WBUFP(buf,n*s+14), &stor->storage_[i]);
+#endif
+ n++;
+ }
}
if(n){
- WBUFW(buf,2)=4+n*18;
+#if PACKETVER < 5
+ WBUFW(buf,0)=0xa5;
+#else
+ WBUFW(buf,0)=0x1f0;
+#endif
+ WBUFW(buf,2)=4+n*s;
WFIFOSET(fd,WFIFOW(fd,2));
}
-#endif
- return 0;
+ if(ne){
+ WBUFW(bufe,0)=0xa6;
+ WBUFW(bufe,2)=4+ne*20;
+ clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
+ }
}
-/*==========================================
- *
- *------------------------------------------
- */
-int clif_guildstorageequiplist(struct map_session_data *sd,struct guild_storage *stor)
+void clif_cartlist(struct map_session_data *sd)
{
struct item_data *id;
- int i,n,fd;
+ int i,n,ne,fd=sd->fd;
unsigned char *buf;
-
- nullpo_retr(0, sd);
-
- fd=sd->fd;
- WFIFOHEAD(fd, MAX_GUILD_STORAGE * 20 + 4);
- buf=WFIFOP(fd,0);
-
- WBUFW(buf,0)=0xa6;
- for(i=0,n=0;i<MAX_GUILD_STORAGE;i++){
- if(stor->storage_[i].nameid<=0)
- continue;
- nullpo_retr(0, id = itemdb_search(stor->storage_[i].nameid));
- if(!itemdb_isequip2(id))
+ unsigned char bufe[MAX_CART*20+4];
+#if PACKETVER < 5
+ const int s = 10; //Entry size.
+#else
+ const int s = 18;
+#endif
+ WFIFOHEAD(fd, MAX_CART * s + 4);
+ buf = WFIFOP(fd,0);
+
+ for(i=0,n=0,ne=0;i<MAX_CART;i++){
+ if(sd->status.cart[i].nameid<=0)
continue;
- WBUFW(buf,n*20+4)=i+1;
- if(id->view_id > 0)
- WBUFW(buf,n*20+6)=id->view_id;
- else
- WBUFW(buf,n*20+6)=stor->storage_[i].nameid;
- WBUFB(buf,n*20+8)=itemtype(id->type);
- WBUFB(buf,n*20+9)=stor->storage_[i].identify;
- WBUFW(buf,n*20+10)=id->equip;
- WBUFW(buf,n*20+12)=stor->storage_[i].equip;
- WBUFB(buf,n*20+14)=stor->storage_[i].attribute;
- WBUFB(buf,n*20+15)=stor->storage_[i].refine;
- clif_addcards(WBUFP(buf, n*20+16), &stor->storage_[i]);
- n++;
+ id = itemdb_search(sd->status.cart[i].nameid);
+ if(itemdb_isequip2(id))
+ { //Equippable
+ WBUFW(bufe,ne*20+4)=i+2;
+ clif_item_sub(bufe, ne*20+6, &sd->status.cart[i], id, id->equip);
+ clif_addcards(WBUFP(bufe, ne*20+16), &sd->status.cart[i]);
+ ne++;
+ } else { //Stackable
+ WBUFW(buf,n*s+4)=i+2;
+ clif_item_sub(buf, n*s+6, &sd->status.cart[i], id, 0);
+#if PACKETVER >= 5
+ clif_addcards(WBUFP(buf,n*s+14), &sd->status.cart[i]);
+#endif
+ n++;
+ }
}
if(n){
- WBUFW(buf,2)=4+n*20;
+#if PACKETVER < 5
+ WBUFW(buf,0)=0x123;
+#else
+ WBUFW(buf,0)=0x1ef;
+#endif
+ WBUFW(buf,2)=4+n*s;
WFIFOSET(fd,WFIFOW(fd,2));
}
- return 0;
+ if(ne){
+ WBUFW(bufe,0)=0x122;
+ WBUFW(bufe,2)=4+ne*20;
+ clif_send(bufe, WBUFW(bufe,2), &sd->bl, SELF);
+ }
+ return;
}
// Guild XY locators [Valaris]
@@ -5533,116 +5455,6 @@ int clif_cart_delitem(struct map_session_data *sd,int n,int amount) }
/*==========================================
- * カートのアイテムリスト
- *------------------------------------------
- */
-int clif_cart_itemlist(struct map_session_data *sd)
-{
- struct item_data *id;
- int i,n,fd;
- unsigned char *buf;
-
- nullpo_retr(0, sd);
-
- fd=sd->fd;
- WFIFOHEAD(fd, MAX_CART * 18 + 4);
- buf = WFIFOP(fd,0);
-#if PACKETVER < 5
- for(i=0,n=0;i<MAX_CART;i++){
- if(sd->status.cart[i].nameid<=0)
- continue;
- id = itemdb_search(sd->status.cart[i].nameid);
- if(itemdb_isequip2(id))
- continue;
- WBUFW(buf,n*10+4)=i+2;
- if(id->view_id > 0)
- WBUFW(buf,n*10+6)=id->view_id;
- else
- WBUFW(buf,n*10+6)=sd->status.cart[i].nameid;
- WBUFB(buf,n*10+8)=itemtype(id->type);
- WBUFB(buf,n*10+9)=sd->status.cart[i].identify;
- WBUFW(buf,n*10+10)=sd->status.cart[i].amount;
- WBUFW(buf,n*10+12)=0;
- n++;
- }
- if(n){
- WBUFW(buf,0)=0x123;
- WBUFW(buf,2)=4+n*10;
- WFIFOSET(fd,WFIFOW(fd,2));
- }
-#else
- for(i=0,n=0;i<MAX_CART;i++){
- if(sd->status.cart[i].nameid<=0)
- continue;
- id = itemdb_search(sd->status.cart[i].nameid);
- if(itemdb_isequip2(id))
- continue;
- WBUFW(buf,n*18+4)=i+2;
- if(id->view_id > 0)
- WBUFW(buf,n*18+6)=id->view_id;
- else
- WBUFW(buf,n*18+6)=sd->status.cart[i].nameid;
- WBUFB(buf,n*18+8)=itemtype(id->type);
- WBUFB(buf,n*18+9)=sd->status.cart[i].identify;
- WBUFW(buf,n*18+10)=sd->status.cart[i].amount;
- WBUFW(buf,n*18+12)=0; //Here goes the equip location, which seems unnecessary to fill for the cart data.
- clif_addcards(WBUFP(buf,n*18+14), &sd->status.cart[i]);
- n++;
- }
- if(n){
- WBUFW(buf,0)=0x1ef;
- WBUFW(buf,2)=4+n*18;
- WFIFOSET(fd,WFIFOW(fd,2));
- }
-#endif
- return 0;
-}
-
-/*==========================================
- * カートの装備品リスト
- *------------------------------------------
- */
-int clif_cart_equiplist(struct map_session_data *sd)
-{
- struct item_data *id;
- int i,n,fd;
- unsigned char *buf;
-
- nullpo_retr(0, sd);
-
- fd=sd->fd;
- WFIFOHEAD(fd, MAX_INVENTORY * 20 + 4);
- buf = WFIFOP(fd,0);
-
- for(i=0,n=0;i<MAX_INVENTORY;i++){
- if(sd->status.cart[i].nameid<=0)
- continue;
- id = itemdb_search(sd->status.cart[i].nameid);
- if(!itemdb_isequip2(id))
- continue;
- WBUFW(buf,n*20+4)=i+2;
- if(id->view_id > 0)
- WBUFW(buf,n*20+6)=id->view_id;
- else
- WBUFW(buf,n*20+6)=sd->status.cart[i].nameid;
- WBUFB(buf,n*20+8)=itemtype(id->type);
- WBUFB(buf,n*20+9)=sd->status.cart[i].identify;
- WBUFW(buf,n*20+10)=id->equip;
- WBUFW(buf,n*20+12)=sd->status.cart[i].equip;
- WBUFB(buf,n*20+14)=sd->status.cart[i].attribute;
- WBUFB(buf,n*20+15)=sd->status.cart[i].refine;
- clif_addcards(WBUFP(buf, n*20+16), &sd->status.cart[i]);
- n++;
- }
- if(n){
- WBUFW(buf,0)=0x122;
- WBUFW(buf,2)=4+n*20;
- WFIFOSET(fd,WFIFOW(fd,2));
- }
- return 0;
-}
-
-/*==========================================
* 露店開設
*------------------------------------------
*/
@@ -8188,13 +8000,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) // item
pc_checkitem(sd);
- clif_itemlist(sd);
- clif_equiplist(sd);
+ clif_inventorylist(sd);
// cart
if(pc_iscarton(sd)){
- clif_cart_itemlist(sd);
- clif_cart_equiplist(sd);
+ clif_cartlist(sd);
clif_updatestatus(sd,SP_CARTINFO);
}
diff --git a/src/map/clif.h b/src/map/clif.h index a50f8ec18..951f25065 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -155,14 +155,12 @@ int clif_tradecompleted(struct map_session_data *sd,int fail); // storage
#include "storage.h"
-int clif_storageitemlist(struct map_session_data *sd,struct storage *stor);
-int clif_storageequiplist(struct map_session_data *sd,struct storage *stor);
+void clif_storagelist(struct map_session_data *sd,struct storage *stor);
int clif_updatestorageamount(struct map_session_data *sd,struct storage *stor);
int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int index,int amount);
int clif_storageitemremoved(struct map_session_data *sd,int index,int amount);
int clif_storageclose(struct map_session_data *sd);
-int clif_guildstorageitemlist(struct map_session_data *sd,struct guild_storage *stor);
-int clif_guildstorageequiplist(struct map_session_data *sd,struct guild_storage *stor);
+void clif_guildstoragelist(struct map_session_data *sd,struct guild_storage *stor);
int clif_updateguildstorageamount(struct map_session_data *sd,struct guild_storage *stor);
int clif_guildstorageitemadded(struct map_session_data *sd,struct guild_storage *stor,int index,int amount);
@@ -226,13 +224,12 @@ int clif_charnameupdate(struct map_session_data *ssd); int clif_use_card(struct map_session_data *sd,int idx);
int clif_insert_card(struct map_session_data *sd,int idx_equip,int idx_card,int flag);
-int clif_itemlist(struct map_session_data *sd);
-int clif_equiplist(struct map_session_data *sd);
+void clif_inventorylist(struct map_session_data *sd);
+void clif_equiplist(struct map_session_data *sd);
int clif_cart_additem(struct map_session_data*,int,int,int);
int clif_cart_delitem(struct map_session_data*,int,int);
-int clif_cart_itemlist(struct map_session_data *sd);
-int clif_cart_equiplist(struct map_session_data *sd);
+void clif_cartlist(struct map_session_data *sd);
int clif_item_identify_list(struct map_session_data *sd);
int clif_item_identified(struct map_session_data *sd,int idx,int flag);
diff --git a/src/map/guild.c b/src/map/guild.c index 8e4a16901..78ef6188d 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1410,9 +1410,14 @@ int guild_opposition(struct map_session_data *sd,int char_id) if(g->alliance[i].opposition==1){ // すでに敵対
clif_guild_oppositionack(sd,2);
return 0;
- }else // 同盟破棄
+ } else { //Change alliance to opposition.
+ if(agit_flag) {
+ clif_displaymessage(sd->fd,"You cannot break an alliance during Guild Wars!");
+ return 0;
+ }
intif_guild_alliance( sd->status.guild_id,tsd->status.guild_id,
sd->status.account_id,tsd->status.account_id,8 );
+ }
}
}
diff --git a/src/map/intif.c b/src/map/intif.c index 4081997d6..d26c37d93 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -952,8 +952,7 @@ int intif_parse_LoadStorage(int fd) { stor->dirty=0;
stor->storage_status=1;
sd->state.storage_flag = 1;
- clif_storageitemlist(sd,stor);
- clif_storageequiplist(sd,stor);
+ clif_storagelist(sd,stor);
clif_updatestorageamount(sd,stor);
return 0;
@@ -1011,8 +1010,7 @@ int intif_parse_LoadGuildStorage(int fd) memcpy(gstor,RFIFOP(fd,12),sizeof(struct guild_storage));
gstor->storage_status = 1;
sd->state.storage_flag = 2;
- clif_guildstorageitemlist(sd,gstor);
- clif_guildstorageequiplist(sd,gstor);
+ clif_guildstoragelist(sd,gstor);
clif_updateguildstorageamount(sd,gstor);
return 0;
}
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 603f20849..86c79f52f 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -262,17 +262,32 @@ int itemdb_isequip(int nameid) *------------------------------------------
*/
int itemdb_isequip2(struct item_data *data)
-{
- if(data) {
- int type=data->type;
- if(type==0 || type==2 || type==3 || type==6 || type==10)
+{
+ nullpo_retr(0, data);
+ switch(data->type) {
+ case 0:
+ case 2:
+ case 3:
+ case 6:
+ case 10:
return 0;
- else
+ default:
return 1;
}
- return 0;
+}
+//Checks if the item is pet-equipment (7/8)
+static int itemdb_ispetequip(struct item_data *data)
+{
+ switch(data->type) {
+ case 7:
+ case 8:
+ return 1;
+ default:
+ return 0;
+ }
}
+
/*==========================================
* Trade Restriction functions [Skotlex]
*------------------------------------------
@@ -584,7 +599,7 @@ static int itemdb_read_itemslottable(void) struct item_data* item;
sscanf(p, "%d#%d#", &nameid, &equip);
item = itemdb_search(nameid);
- if (item && itemdb_isequip2(item))
+ if (equip && item && itemdb_isequip2(item))
item->equip = equip;
p = strchr(p, 10);
if(!p) break;
@@ -852,6 +867,11 @@ static int itemdb_read_sqldb(void) id->class_upper= (sql_row[12] != NULL) ? atoi(sql_row[12]) : 0;
id->sex = (sql_row[13] != NULL) ? atoi(sql_row[13]) : 0;
id->equip = (sql_row[14] != NULL) ? atoi(sql_row[14]) : 0;
+ if (!id->equip && itemdb_isequip2(id) && !itemdb_ispetequip(id))
+ {
+ ShowWarning("Item %d (%s) is an equipment with no equip-field! Making it an etc item.\n", nameid, id->jname);
+ id->type = 3;
+ }
id->wlv = (sql_row[15] != NULL) ? atoi(sql_row[15]) : 0;
id->elv = (sql_row[16] != NULL) ? atoi(sql_row[16]) : 0;
id->flag.no_refine = (sql_row[17] == NULL || atoi(sql_row[17]) == 1)?0:1;
@@ -1019,6 +1039,11 @@ static int itemdb_readdb(void) if(id->equip != atoi(str[14])){
id->equip=atoi(str[14]);
}
+ if (!id->equip && itemdb_isequip2(id) && !itemdb_ispetequip(id))
+ {
+ ShowWarning("Item %d (%s) is an equipment with no equip-field! Making it an etc item.\n", nameid, id->jname);
+ id->type = 3;
+ }
id->wlv=atoi(str[15]);
id->elv=atoi(str[16]);
id->flag.no_refine = atoi(str[17])?0:1; //If the refine column is 1, no_refine is 0
diff --git a/src/map/npc.c b/src/map/npc.c index b8f86e88f..8e4182615 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1048,9 +1048,9 @@ TBL_NPC *npc_checknear(struct map_session_data *sd,struct block_list *bl) if (bl->m!=sd->bl.m ||
bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1)
- return nd;
+ return NULL;
- return NULL;
+ return nd;
}
/*==========================================
diff --git a/src/map/path.c b/src/map/path.c index 1255f655d..8db44feb6 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -203,10 +203,10 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) return -1;
md=&map[m];
- if(count>15){ // 最大10マスに制限
+ if(count>25){ //Cap to prevent too much processing...?
if(battle_config.error_log)
ShowWarning("path_blownpos: count too many %d !\n",count);
- count=15;
+ count=25;
}
if(dx>1 || dx<-1 || dy>1 || dy<-1){
if(battle_config.error_log)
@@ -215,7 +215,7 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) dy=(dy>=0)?1:((dy<0)?-1:0);
}
- while( (count--)>0 && (dx!=0 || dy!=0) ){
+ while( (count--)>0 && (dx || dy) ){
if( !can_move(md,x0,y0,x0+dx,y0+dy,0) ){
int fx=(dx!=0 && can_move(md,x0,y0,x0+dx,y0,0));
int fy=(dy!=0 && can_move(md,x0,y0,x0,y0+dy,0));
diff --git a/src/map/pc.c b/src/map/pc.c index 16baba08f..a0b5956e8 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -385,7 +385,6 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo int pc_equippoint(struct map_session_data *sd,int n)
{
int ep = 0;
- //?生や養子の場合の元の職業を算出する
nullpo_retr(0, sd);
@@ -4029,7 +4028,7 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int clif_updatestatus(sd,SP_BASEEXP);
- if (job_exp > 0 && sd->status.job_exp > UINT_MAX - job_exp)
+ if (job_exp && sd->status.job_exp > UINT_MAX - job_exp)
sd->status.job_exp = UINT_MAX;
else
sd->status.job_exp += job_exp;
@@ -5340,7 +5339,6 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) status_calc_pc(sd,0);
pc_checkallowskill(sd);
pc_equiplookall(sd);
- clif_equiplist(sd);
//if you were previously famous, not anymore.
if (fame_flag) {
@@ -5532,8 +5530,7 @@ int pc_setcart(struct map_session_data *sd,int type) option|=cart[type];
if(!pc_iscarton(sd)){ // カ?トを付けていない
pc_setoption(sd,option);
- clif_cart_itemlist(sd);
- clif_cart_equiplist(sd);
+ clif_cartlist(sd);
clif_updatestatus(sd,SP_CARTINFO);
clif_status_change(&sd->bl,SI_INCREASEAGI,0); //0x0c is 12, Increase Agi??
}
diff --git a/src/map/storage.c b/src/map/storage.c index cb51327f3..c420795a1 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -149,8 +149,7 @@ int storage_storageopen(struct map_session_data *sd) stor->storage_status = 1;
sd->state.storage_flag = 1;
- clif_storageitemlist(sd,stor);
- clif_storageequiplist(sd,stor);
+ clif_storagelist(sd,stor);
clif_updatestorageamount(sd,stor);
return 0;
}
@@ -476,8 +475,7 @@ int storage_guild_storageopen(struct map_session_data *sd) gstor->storage_status = 1;
sd->state.storage_flag = 2;
- clif_guildstorageitemlist(sd,gstor);
- clif_guildstorageequiplist(sd,gstor);
+ clif_guildstoragelist(sd,gstor);
clif_updateguildstorageamount(sd,gstor);
return 0;
}
diff --git a/src/map/unit.c b/src/map/unit.c index ff786e7cd..966b07192 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -815,7 +815,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int case NPC_SUMMONSLAVE:
case NPC_SUMMONMONSTER:
case AL_TELEPORT:
- if (((TBL_MOB*)src)->master_id)
+ if (((TBL_MOB*)src)->master_id && ((TBL_MOB*)src)->special_state.ai)
return 0;
}
}
|