def SellItem(self): if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber): if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber): ## 용혼석도 팔리게 하는 기능 추가하면서 인자 type 추가 net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY) snd.PlaySound("sound/ui/money.wav") self.OnCloseQuestionDialog()
def OnUpdate(self): val, self.lastTime = OpenLib.timeSleep(self.lastTime, TIME_WAIT) if not val or self.State == STATE_NONE or not OpenLib.IsInGamePhase(): return if self.State == STATE_WAITING_OPEN_SHOP: #chat.AppendChat(3,"Waiting for shop to be open.") if shop.IsOpen(): self.State = STATE_SELLING return self.OpenShop() if self.State == STATE_SELLING: val, self.lastTimeSell = OpenLib.timeSleep(self.lastTimeSell, TIME_SELL) if val: if len(self.sellItems_list) == 0: self.State = STATE_BUYING return slot = self.sellItems_list.pop(0) net.SendShopSellPacketNew(slot, player.GetItemCount(slot), 1) chat.AppendChat(3, "[NPC-SHOPER] Sold item at slot " + str(slot)) return if self.State == STATE_BUYING: val, self.lastTimeBuy = OpenLib.timeSleep(self.lastTimeBuy, TIME_BUY) if (val): if len(self.buyItems_list) == 0: self.State = STATE_FINISH_SHOPPING return slot = self.buyItems_list.pop(0) net.SendShopBuyPacket(slot) else: return if self.State == STATE_FINISH_SHOPPING: self.EndNPCBusiness() return if self.State == STATE_GIVING_ITEMS: val, self.lastTimeGive = OpenLib.timeSleep(self.lastTimeGive, TIME_GIVE_ITEM) if not val: return if len(self.giveItems_list) == 0: self.EndNPCGiveItem() return else: vid = self.npcAction.SearchVIDClosest() if vid == None: #chat.AppendChat(3,"[NPC-GIVER] No NPC with vid " +str(vid)+" is close.") self.EndNPCGiveItem() return else: slot = self.giveItems_list.pop() #chat.AppendChat(3,"[NPC-GIVER] Giving "+ str(player.GetItemCount(slot)) + " item(s) at slot " +str(slot)+" to VID " +str(vid)) net.SendGiveItemPacket(vid, player.SLOT_TYPE_INVENTORY, slot, player.GetItemCount(slot)) OpenLib.skipAnswers(self.npcAction.event_answer)
def OnUpdate(self): val, self.lastTime = OpenLib.timeSleep(self.lastTime, self.TIME_WAIT) if val: if len(self.toDropSlots) > 0: slot = self.toDropSlots.pop(0) net.SendItemDropPacketNew(slot, player.GetItemCount(slot)) return if len(self.toSellSlots) > 0: slot = self.toSellSlots.pop(0) net.SendShopSellPacketNew(slot, player.GetItemCount(slot), 1) return if len(self.toStackMoveActions) > 0: args = self.toStackMoveActions.pop(0) OpenLog.DebugPrint("[STACK] - Changing item position from " + str(args[0]) + " to " + str(args[1]) + " count " + str(args[2])) net.SendItemMovePacket(args[0], args[1], args[2]) return if len(self.toSortMoveActions) > 0: args = self.toSortMoveActions.pop(0) OpenLog.DebugPrint("[SORT] - Changing item position from " + str(args[0]) + " to " + str(args[1]) + " count " + str(args[2])) net.SendItemMovePacket(args[0], args[1], args[2]) return if len(self.toBuySlots) > 0: slot = self.toBuySlots.pop(0) net.SendShopBuyPacket(slot) return if self.callback != None: self.callback() self.callback = None
def SellItem(self): net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count) snd.PlaySound("sound/ui/money.wav") self.OnCloseQuestionDialog()
def OnSellItem(self, slotPos, count, itemtype): net.SendShopSellPacketNew(slotPos, count, itemtype) snd.PlaySound("sound/ui/money.wav") self.OnCloseQuestionDialog()