def giveItem(self,player,itemId,count): item = player.getInventory().addItem("Quest", itemId, count, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu) sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) return item
def giveItem(self, player, itemId, count): item = player.getInventory().addItem("Quest", itemId, count, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu) sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) return item
def EvolvePet(player,item,striderControlItem) : con = L2DatabaseFactory.getInstance().getConnection() statement = con.prepareStatement("UPDATE items SET item_id =? WHERE object_id=? AND owner_id=?") statement.setInt(1, striderControlItem) statement.setInt(2, item.getObjectId()) statement.setInt(3, player.getObjectId()) statement.execute() statement.close() con.close() sm1 = SystemMessage(SystemMessageId.S2_S1_DISAPPEARED) sm1.addItemName(item.getItemId()) sm1.addNumber(1) sm2 = SystemMessage(SystemMessageId.YOU_PICKED_UP_A_S1_S2) sm2.addNumber(item.getEnchantLevel()) sm2.addItemName(striderControlItem) player.sendPacket(sm1) player.sendPacket(sm2) player.sendPacket(ItemList(player, False)) return
def onTalk (self,npc,player): npcId = npc.getNpcId() if npcId == YIYEN : tele = PyObject() tele.x = 146534 tele.y = 180464 tele.z = -6117 instanceId = enterInstance(self, player, "DarkCloudMansion.xml", tele) if not instanceId: return if instanceId == 0: return elif npcId == SOTruth : if npc.getInstanceId() == 0: return world = self.worlds[npc.getInstanceId()] item = player.getInventory().addItem("Quest", CC, 1, player, None) iu = InventoryUpdate() iu.addItem(item) player.sendPacket(iu) sm = SystemMessage(SystemMessageId.YOU_PICKED_UP_S1_S2) sm.addItemName(item) sm.addNumber(1) player.sendPacket(sm) tele = PyObject() tele.x = 139968 tele.y = 150367 tele.z = -3111 exitInstance(player,tele) if debug: print "DarkCloudMansion - id"+str(player.getObjectId())+" rewarded and gone out of instance" # Check if the instance is empty, as it should be destroyed directly if yes according to retail info. playerList = InstanceManager.getInstance().getInstance(world.instanceId).getPlayers().toArray() playerCount = len(playerList) if playerCount == 0: del self.worlds[npc.getInstanceId()] self.world_ids.remove(npc.getInstanceId()) InstanceManager.getInstance().destroyInstance(npc.getInstanceId()) return