Refa unele parti din game.py

mic tutorial ce am gasit pe forumuri ..
### ConstInfo.py
BorrarItems = {
"QID" : 0,
"BORRAR" : "",
}
### Game.py
En el __ServerCommand_Build, pegar esto:
"BORRAR" : self.ManagerBorrar,
def BINARY_ServerCommand_Run(self, line):
Añadir:
def ItemRemoveGetInputOff(self):
constInfo.INPUT_IGNORE = 0
Buscar:
"MyShopPriceList" : self.__PrivateShop_PriceList,
Añadir:
"InputStringEnd" : self.ItemRemoveGetInputOff,
Cambio
def OpenQuestWindow(self, skin, idx):
if constInfo.INPUT_IGNORE == 1:
return
else:
self.interface.OpenQuestWindow(skin, idx)
Open constinfo.py and add this:
INPUT_IGNORE = 0
def OpenQuestWindow(self, skin, idx):
if constInfo.INPUT_IGNORE == 1:
return
else:
self.interface.OpenQuestWindow(skin, idx)
Al final del game.py pegar esto:
def ManagerBorrar(self, cmd):
cmd = cmd.split("|")
if cmd[0] == "QID":
constInfo.BorrarItems["QID"] = int(cmd[1])
elif cmd[0] == "SEND":
net.SendQuestInputStringPacket(str(constInfo.BorrarItems["BORRAR"]))
constInfo.BorrarItems["BORRAR"] = ""
elif cmd[0] == "INPUT":
constInfo.INPUT_IGNORE = int(cmd[1])
### uiInventory.py
import event
Debajo de
wndEquip = self.GetChild("EquipmentSlot")
Pegar esto:
wndBorrar = self.GetChild("BorrarSlot")
Debajo de:
self.costumeButton = self.GetChild2("CostumeButton")
Pegar:
self.borrar_items = self.GetChild2("BorrarItems")
Debajo de:
self.attachMetinDialog.Hide()
Pegar esto:
self.drag = ui.Bar()
self.drag.SetPosition(13+50,538)
self.drag.SetParent(self)
self.drag.SetColor(grp.GenerateColor(0.0, 0.0, 0.0, 0.0))
self.drag.SetSize(32,32)
self.drag.OnMouseLeftButtonUp = lambda: self.Add_Item()
self.drag.Show()
wndBorrar.SetOverInItemEvent(ui.__mem_func__(self.OverBorrarIn))
wndBorrar.SetOverOutItemEvent(ui.__mem_func__(self.OverBorrarOut))
self.RemoveQuestion = uiCommon.QuestionDialog()
self.RemoveQuestion.SetAcceptEvent(lambda arg = TRUE: self.Borrar_Item(arg))
self.RemoveQuestion.SetCancelEvent(lambda arg = FALSE: self.Borrar_Item(arg))
self.RemoveQuestion.Close()
Debajo del def Close(self):
Pegar esto:
def OverBorrarIn(self):
self.ShowToolTip(0)
def OverBorrarOut(self):
self.tooltipItem.HideToolTip()
def Add_Item(self):
if mouseModule.mouseController.isAttached():
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedSlotVnum = mouseModule.mouseController.GetAttachedItemIndex()
# item.SelectItem(attachedSlotVnum)
if player.SLOT_TYPE_INVENTORY == attachedSlotType:
item.SelectItem(attachedSlotVnum)
self.RemoveQuestion.SetText("¿Seguro que quieres borrar "+str(item.GetItemName())+"?")
self.RemoveQuestion.Open()
constInfo.BorrarItems["BORRAR"] = ""
constInfo.BorrarItems["BORRAR"] = "BORRAR|"+str(attachedSlotPos)+"|"+str(attachedSlotVnum)
#chat.AppendChat(1, constInfo.BorrarItems["BORRAR"])
mouseModule.mouseController.DeattachObject()
def Borrar_Item(self, arg):
if arg:
event.QuestButtonClick(constInfo.BorrarItems["QID"])
self.RemoveQuestion.Close()
### locale/inventorywindow.py
Debajo de:
## Item Slot
{
"name" : "ItemSlot",
"type" : "grid_table",
"x" : 8,
"y" : 246,
"start_index" : 0,
"x_count" : 5,
"y_count" : 9,
"x_step" : 32,
"y_step" : 32,
"image" : "d:/ymir work/ui/public/Slot_Base.sub"
},
Pegar esto:
## Borar Items Slot
{
"name" : "BorrarItems",
"type" : "image",
"x" : 13,
"y" : 538,
"image" : "locale/es/ui/inventario/borrar_items.tga",
"children" :
(
{
"name" : "BorrarSlot",
"type" : "slot",
"x" : 0,
"y" : 0,
"width" : 32,
"height" : 32,
"slot" : (
{"index":0, "x":0, "y":0, "width":32, "height":32},
),
},
),
},
quest borrar_items begin
state start begin
when login begin
cmdchat("BORRAR QID|"..q.getcurrentquestindex())
end
when button or info begin
cmdchat("BORRAR INPUT|1")
local shang = split(input(cmdchat("BORRAR SEND|")), "|")
cmdchat("BORRAR INPUT|0")
if shang[1] == "BORRAR" then
borrar_items.Borrar(tonumber(shang[2]), tonumber(shang[3]))
end
end
function Borrar(slot, vnum)
item.select_cell(slot)
local item_vnum, item_count, item_id = item.get_vnum(), item.get_count(), item.get_id()
item.remove_stack()
cmdchat("InputStringEnd")
end
end
end