Tipologie server:
*Resursă folosită: http://just4metin.ro/ghiduri-tutoriale/ ... 67726.html
*ServerFiles utilizat: Zearth 2
*Syserr:
Poză:
[/b]*Detalii suplimentare:
[/b]Cod: Selectaţi tot
import uiScriptLocale
import item
COSTUME_START_INDEX = item.COSTUME_SLOT_START
window = {
"name" : "CostumeEquipmentDialog",
"x" : 0,
"y" : 0,
# "width" : 139,
# "height" : 145,
"width" : 140,
"height" : 180 + 47,
"children" :
(
{
"name" : "ExpandButton",
"type" : "button",
"x" : 2,
"y" : 20,
"default_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_normal.tga",
"over_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_over.tga",
"down_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_down.tga",
"disable_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_disabled.tga",
},
{
"name" : "CostumeEquipmentLayer",
"x" : 5,
"y" : 0,
"width" : 140,
"height" : 180 + 47,
"children" :
(
{
"name" : "MinimizeButton",
"type" : "button",
"x" : 2,
"y" : 17,
"default_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_normal.tga",
"over_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_over.tga",
"down_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_down.tga",
"disable_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_disabled.tga",
},
{
"name" : "CostumeEquipmentBoard",
"type" : "board",
"style" : ("attach", "float"),
"x" : 10,
"y" : 0,
"width" : 129,
"height" : 195,
"children" :
(
{
"name" : "Costume_Base",
"type" : "image",
"x" : 8,
"y" : 8,
"image" : "d:/ymir work/costume_bg.jpg",
"children" :
(
{
"name" : "CostumeEquipmentSlot",
"type" : "slot",
"x" : 3,
"y" : 3,
"width" : 127,
"height" : 195,
"slot" : (
{"index":0, "x":61, "y":45, "width":32, "height":64},
{"index":1, "x":61, "y":45, "width":32, "height":64},
{"index":2, "x":61, "y":45, "width":32, "height":64},
{"index":3, "x":61, "y":45, "width":32, "height":64},
{"index":4, "x":61, "y":45, "width":32, "height":64},
{"index":5, "x":61, "y":45, "width":32, "height":64},
{"index":6, "x":61, "y":45, "width":32, "height":64},
{"index":7, "x":61, "y":45, "width":32, "height":64},
{"index":8, "x":61, "y":45, "width":32, "height":64},
{"index":9, "x":61, "y":45, "width":32, "height":64},
{"index":10, "x":61, "y":45, "width":32, "height":64},
{"index":11, "x":61, "y":45, "width":32, "height":64},
{"index":12, "x":61, "y":45, "width":32, "height":64},
{"index":13, "x":61, "y":45, "width":32, "height":64},
{"index":14, "x":61, "y":45, "width":32, "height":64},
{"index":15, "x":61, "y":45, "width":32, "height":64},
{"index":16, "x":61, "y":45, "width":32, "height":64},
{"index":17 "x":61, "y":45, "width":32, "height":64},
{"index":18, "x":61, "y": 8, "width":32, "height":32},
{"index":19, "x":61, "y":125, "width":32, "height":32},
{"index":20, "x":13, "y":125, "width":32, "height":32},
{"index":21, "x":13, "y":20, "width":32, "height":96},
{"index":22, "x":13, "y":20, "width":32, "height":96},
{"index":23, "x":13, "y":20, "width":32, "height":96},
{"index":24, "x":13, "y":20, "width":32, "height":96},
{"index":25, "x":13, "y":20, "width":32, "height":96},
{"index":26, "x":13, "y":20, "width":32, "height":96},
{"index":27, "x":13, "y":20, "width":32, "height":96},
{"index":28, "x":13, "y":20, "width":32, "height":96},
{"index":29, "x":13, "y":20, "width":32, "height":96},
{"index":30, "x":13, "y":20, "width":32, "height":96},
{"index":31, "x":13, "y":20, "width":32, "height":96},
{"index":32, "x":13, "y":20, "width":32, "height":96},
{"index":34, "x":13, "y":20, "width":32, "height":96},
{"index":35, "x":13, "y":20, "width":32, "height":96},
{"index":36, "x":13, "y":20, "width":32, "height":96},
),
},
),
},
),
},
),
},
),
} Cod: Selectaţi tot
import uiScriptLocale
window = {
"name" : "EquipmentDialog",
"style" : ("movable", "float",),
"x" : 0,
"y" : 0,
"width" : 180,
"height" : 230,
"children" :
(
{
"name" : "Board",
"type" : "board_with_titlebar",
"x" : 0,
"y" : 0,
"width" : 180,
"height" : 230,
"title" : "Character Name",
"children" :
(
{
"name":"EquipmentBaseImage",
"type":"image",
"style" : ("attach",),
"x" : 0,
"y" : 9,
"horizontal_align" : "center",
"vertical_align" : "center",
"image" : "d:/ymir work/inventar_dnd.tga",
"children" :
(
{
"name" : "EquipmentSlot",
"type" : "slot",
"x" : 3,
"y" : 3,
"width" : 150,
"height" : 182,
"slot" : (
{"index":0, "x":44, "y":40, "width":32, "height":64},#armu
{"index":1, "x":44, "y":2, "width":32, "height":32}, #coif
{"index":2, "x":44, "y":151, "width":32, "height":32},#papuc
{"index":3, "x":82, "y":72, "width":32, "height":32},#bratara
{"index":4, "x":3, "y":3, "width":32, "height":96},#arma
{"index":5, "x":117, "y":75, "width":32, "height":32},#colier #DnD Works#
{"index":6, "x":118, "y":41, "width":32, "height":32},#cercei
{"index":7, "x":7, "y":151, "width":32, "height":32},#special acadea
{"index":8, "x":79, "y":151, "width":32, "height":32},#special inel
{"index":9, "x":115, "y":4, "width":32, "height":32},#sageata
{"index":10, "x":81, "y":42, "width":32, "height":32},#Scut
{"index":13, "x":117, "y":150, "width":32, "height":32},#Atac
{"index":14, "x":117, "y":112, "width":32, "height":32},#Aparare
{"index":15, "x":82, "y":102, "width":32, "height":32},#curea
),
},
),
},
),
},
),
}
Cod: Selectaţi tot
import ui
import chr
import player
class CostumeEquipmentDialog(ui.ScriptWindow):
def __init__(self, wndEquipment):
if not wndEquipment:
import exception
exception.Abort("wndEquipment parameter must be set to CostumeEquipmentDialog")
return
ui.ScriptWindow.__init__(self)
self.isLoaded = 0
self.wndEquipment = wndEquipment;
self.wndCostumeEquipmentLayer = None
self.wndCostumeEquipmentSlot = None
self.expandBtn = None
self.minBtn = None
self.__LoadWindow()
def __del__(self):
ui.ScriptWindow.__del__(self)
def Show(self):
self.__LoadWindow()
ui.ScriptWindow.Show(self)
self.CloseCostumeEquipment()
def Close(self):
self.Hide()
def IsOpenedCostumeEquipment(self):
return self.wndCostumeEquipmentLayer.IsShow()
def OpenCostumeEquipment(self):
self.wndCostumeEquipmentLayer.Show()
self.expandBtn.Hide()
self.AdjustPositionAndSize()
self.RefreshSlot()
def CloseCostumeEquipment(self):
self.wndCostumeEquipmentLayer.Hide()
self.expandBtn.Show()
self.AdjustPositionAndSize()
def GetBasePosition(self):
x, y = self.wndEquipment.GetGlobalPosition()
return x - 139, y + 30
def AdjustPositionAndSize(self):
bx, by = self.GetBasePosition()
if self.IsOpenedCostumeEquipment():
self.SetPosition(bx, by)
self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
else:
self.SetPosition(bx + 129, by);
self.SetSize(10, self.GetHeight())
def __LoadWindow(self):
if self.isLoaded == 1:
return
self.isLoaded = 1
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/CostumeEquipmentDialog.py")
except:
import exception
exception.Abort("CostumeEquipmentDialog.LoadWindow.LoadObject")
try:
self.ORIGINAL_WIDTH = self.GetWidth()
wndCostumeEquipmentSlot = self.GetChild("CostumeEquipmentSlot")
self.wndCostumeEquipmentLayer = self.GetChild("CostumeEquipmentLayer")
self.expandBtn = self.GetChild("ExpandButton")
self.minBtn = self.GetChild("MinimizeButton")
self.expandBtn.SetEvent(ui.__mem_func__(self.OpenCostumeEquipment))
self.minBtn.SetEvent(ui.__mem_func__(self.CloseCostumeEquipment))
except:
import exception
exception.Abort("CostumeEquipmentDialog.LoadWindow.BindObject")
wndCostumeEquipmentSlot.SetOverInItemEvent(ui.__mem_func__(self.wndEquipment.OverInItem))
wndCostumeEquipmentSlot.SetOverOutItemEvent(ui.__mem_func__(self.wndEquipment.OverOutItem))
self.wndCostumeEquipmentSlot = wndCostumeEquipmentSlot
def RefreshSlot(self):
equipmentDict = self.wndEquipment.itemDataDict
for i in [11, 12]:
if equipmentDict.has_key(i):
self.wndCostumeEquipmentSlot.SetItemSlot(i, equipmentDict[i][0], equipmentDict[i][1])
class EquipmentDialog(ui.ScriptWindow):
wndCostumeEquipment = None
def __init__(self):
#print "NEW EQUIPMENT DIALOG ----------------------------------------------------------------------------"
ui.ScriptWindow.__init__(self)
self.__LoadDialog()
self.vid = None
self.eventClose = None
self.itemDataDict = {}
self.tooltipItem = None
def __del__(self):
#print "---------------------------------------------------------------------------- DELETE EQUIPMENT DIALOG "
ui.ScriptWindow.__del__(self)
def __LoadDialog(self):
try:
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/EquipmentDialog.py")
getObject = self.GetChild
self.board = getObject("Board")
self.slotWindow = getObject("EquipmentSlot")
self.wndCostumeEquipment = CostumeEquipmentDialog(self)
except:
import exception
exception.Abort("EquipmentDialog.LoadDialog.BindObject")
self.board.SetCloseEvent(ui.__mem_func__(self.Close))
self.slotWindow.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
self.slotWindow.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
def Open(self, vid):
self.vid = vid
self.itemDataDict = {}
name = chr.GetNameByVID(vid)
self.board.SetTitleName(name)
self.SetCenterPosition()
self.SetTop()
self.Show()
if self.wndCostumeEquipment:
self.wndCostumeEquipment.Show()
def Close(self):
self.itemDataDict = {}
self.tooltipItem = None
self.Hide()
if self.eventClose:
self.eventClose(self.vid)
if self.wndCostumeEquipment:
self.wndCostumeEquipment.Close()
def Destroy(self):
self.eventClose = None
self.Close()
self.ClearDictionary()
self.board = None
self.slotWindow = None
if self.wndCostumeEquipment:
self.wndCostumeEquipment.Destroy()
self.wndCostumeEquipment = None
def SetEquipmentDialogItem(self, slotIndex, vnum, count):
if count <= 1:
count = 0
self.slotWindow.SetItemSlot(slotIndex, vnum, count)
emptySocketList = []
emptyAttrList = []
for i in xrange(player.METIN_SOCKET_MAX_NUM):
emptySocketList.append(0)
for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
emptyAttrList.append((0, 0))
self.itemDataDict[slotIndex] = (vnum, count, emptySocketList, emptyAttrList)
def SetEquipmentDialogSocket(self, slotIndex, socketIndex, value):
if not slotIndex in self.itemDataDict:
return
if socketIndex < 0 or socketIndex > player.METIN_SOCKET_MAX_NUM:
return
self.itemDataDict[slotIndex][2][socketIndex] = value
def SetEquipmentDialogAttr(self, slotIndex, attrIndex, type, value):
if not slotIndex in self.itemDataDict:
return
if attrIndex < 0 or attrIndex > player.ATTRIBUTE_SLOT_MAX_NUM:
return
self.itemDataDict[slotIndex][3][attrIndex] = (type, value)
def SetItemToolTip(self, tooltipItem):
self.tooltipItem = tooltipItem
def SetCloseEvent(self, event):
self.eventClose = event
def OverInItem(self, slotIndex):
if None == self.tooltipItem:
return
if not slotIndex in self.itemDataDict:
return
itemVnum = self.itemDataDict[slotIndex][0]
if 0 == itemVnum:
return
self.tooltipItem.ClearToolTip()
metinSlot = self.itemDataDict[slotIndex][2]
attrSlot = self.itemDataDict[slotIndex][3]
self.tooltipItem.AddItemData(itemVnum, metinSlot, attrSlot)
self.tooltipItem.ShowToolTip()
def OverOutItem(self):
if None != self.tooltipItem:
self.tooltipItem.HideToolTip()
def OnPressEscapeKey(self):
self.Close()
return True
def OnMoveWindow(self, x, y):
if self.wndCostumeEquipment:
self.wndCostumeEquipment.AdjustPositionAndSize()
Cod: Selectaţi tot
void CHARACTER::SendEquipment(LPCHARACTER ch)
{
TPacketViewEquip p;
p.header = HEADER_GC_VIEW_EQUIP;
p.vid = GetVID();
int pos[19] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 21, 22, 23, 24, 25, 26 };
for (int i = 0; i < 19; i++)
{
LPITEM item = GetWear(pos[i]);
if (item)
{
p.equips[i].vnum = item->GetVnum();
p.equips[i].count = item->GetCount();
thecore_memcpy(p.equips[i].alSockets, item->GetSockets(), sizeof(p.equips[i].alSockets));
thecore_memcpy(p.equips[i].aAttr, item->GetAttributes(), sizeof(p.equips[i].aAttr));
}
else
{
p.equips[i].vnum = 0;
}
}
ch->GetDesc()->Packet(&p, sizeof(p));
}
Cod: Selectaţi tot
int pos[19] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 21, 22, 23, 24, 25, 26 };
for (int i = 0; i < 19; i++)


Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 168 vizitatori