Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. def sendShopList(this, sendItems=True):
  2. shopItems = [] if this.client.shopItems == "" else this.client.shopItems.split(",")
  3.  
  4. packet = ByteArray().writeInt(this.client.shopCheeses).writeInt(this.client.shopFraises).writeUTF(this.client.playerLook).writeInt(len(shopItems))
  5. for item in shopItems:
  6. if "_" in item:
  7. itemSplited = item.split("_")
  8. realItem = itemSplited[0]
  9. custom = itemSplited[1] if len(itemSplited) >= 2 else ""
  10. realCustom = [] if custom == "" else custom.split("+")
  11.  
  12. packet.writeByte(len(realCustom)+1).writeInt(int(realItem))
  13.  
  14. x = 0
  15. while x < len(realCustom):
  16. packet.writeInt(int(realCustom[x], 16))
  17. x += 1
  18. else:
  19. packet.writeByte(0).writeInt(int(item))
  20.  
  21. shop = this.server.shopList if sendItems else []
  22. packet.writeInt(len(shop))
  23.  
  24. for item in shop:
  25. value = item.split(",")
  26. packet.writeShort(int(value[0]))
  27. packet.writeShort(int(value[1])).writeByte(int(value[2])).writeByte(int(value[3])).writeByte(int(value[4])).writeInt(int(value[5])).writeInt(int(value[6])).writeShort(0)
  28.  
  29. looks = []
  30. packet.writeByte(len(looks))
  31. for look in looks:
  32. packet.writeShort(look[0])
  33. packet.writeUTF(look[1])
  34. packet.writeByte(look[2])
  35.  
  36. packet.writeShort(len(this.client.clothes))
  37.  
  38. for clothe in this.client.clothes:
  39. clotheSplited = clothe.split("/")
  40. packet.writeUTF(clotheSplited[1] + ";" + clotheSplited[2] + ";" + clotheSplited[3])
  41.  
  42. shamanItems = [] if this.client.shamanItems == "" else this.client.shamanItems.split(",")
  43. packet.writeShort(len(shamanItems))
  44.  
  45. for item in shamanItems:
  46. if "_" in item:
  47. itemSplited = item.split("_")
  48. realItem = itemSplited[0]
  49. custom = itemSplited[1] if len(itemSplited) >= 2 else ""
  50. realCustom = [] if custom == "" else custom.split("+")
  51.  
  52. packet.writeShort(int(realItem))
  53.  
  54. packet.writeBool(item in this.client.shamanLook.split(",")).writeByte(len(realCustom)+1)
  55.  
  56. x = 0
  57. while x < len(realCustom):
  58. packet.writeInt(int(realCustom[x], 16))
  59. x += 1
  60. else:
  61. packet.writeShort(int(item)).writeBool(item in this.client.shamanLook.split(",")).writeByte(0)
  62.  
  63. shamanShop = this.server.shamanShopList if sendItems else []
  64. packet.writeShort(len(shamanShop))
  65.  
  66. for item in shamanShop:
  67. value = item.split(",")
  68. packet.writeInt(int(value[0])).writeByte(int(value[1])).writeByte(int(value[2])).writeInt(int(value[3])).writeShort(int(value[4]))
  69.  
  70. this.client.sendPacket(Identifiers.send.Shop_List, packet.toByteArray())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement