Hey there,
I have an Halloween gift for you all. i have been working for a few hours on official like element image on target window(See screens below).
When you click on a mob if it is defined as elemental, it will open an element image in addition to the target window.
Don't forget to hit the like button!
(C) Metin2 guild wars - coded by [GA]Ruin - 27/10/2017 (I create custom metin2 systems in c++/python. if you want a custom system send me a pm and we can talk over skype).
Client files:
Let's begin!
Server Side:
Open service.h, add in the end:
Open char.cpp, search for
- else{p.dwVID = 0;p.bHPPercent = 0;}
add below:
- #ifdef ELEMENT_TARGET const int ELEMENT_BASE = 11; DWORD curElementBase = ELEMENT_BASE; DWORD raceFlag; if (m_pkChrTarget && m_pkChrTarget->IsMonster() && (raceFlag = m_pkChrTarget->GetMobTable().dwRaceFlag) >= RACE_FLAG_ATT_ELEC) { for (int i = RACE_FLAG_ATT_ELEC; i <= RACE_FLAG_ATT_DARK; i *= 2) { curElementBase++; int diff = raceFlag - i; if (abs(diff) <= 1024) break; } p.bElement = curElementBase - ELEMENT_BASE; } else { p.bElement = 0; } #endif
open packet.h, search for:
add above:
- #ifdef ELEMENT_TARGETBYTE bElement;#endif
Client side:
open locale_inc.h, add in the end:
open packet.h, search for*
add above:
- #ifdef ELEMENT_TARGETBYTE bElement;#endif
open PythonNetworkPhaseGame.cpp, look for:
- else if (pInstPlayer->CanViewTargetHP(*pInstTarget))
replace below with the following:
- #ifdef ELEMENT_TARGET PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetHPTargetBoard", Py_BuildValue("(iii)", TargetPacket.dwVID, TargetPacket.bHPPercent, TargetPacket.bElement));#else PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "SetHPTargetBoard", Py_BuildValue("(ii)", TargetPacket.dwVID, TargetPacket.bHPPercent)); #endif
open PythonApplicationModule.cpp, look for*
- #ifdef ENABLE_ENERGY_SYSTEM
add above:
- #ifdef ELEMENT_TARGETPyModule_AddIntConstant(poModule, "ENABLE_VIEW_ELEMENT", 1);#elsePyModule_AddIntConstant(poModule, "ENABLE_VIEW_ELEMENT", 0);#endif
open game.py, look for*
- def SetHPTargetBoard(self, vid, hpPercentage): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.ResetTargetBoard() self.targetBoard.SetEnemyVID(vid) self.targetBoard.SetHP(hpPercentage) self.targetBoard.Show()
replace with:
- if app.ENABLE_VIEW_ELEMENT: def SetHPTargetBoard(self, vid, hpPercentage,bElement): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.ResetTargetBoard() self.targetBoard.SetEnemyVID(vid) self.targetBoard.SetHP(hpPercentage) self.targetBoard.SetElementImage(bElement) self.targetBoard.Show() else: def SetHPTargetBoard(self, vid, hpPercentage): if vid != self.targetBoard.GetTargetVID(): self.targetBoard.ResetTargetBoard() self.targetBoard.SetEnemyVID(vid) self.targetBoard.SetHP(hpPercentage) self.targetBoard.Show()
open uitarget.py, look for*
add below:
- if app.ENABLE_VIEW_ELEMENT:ELEMENT_IMAGE_DIC = {1: "elect", 2: "fire", 3: "ice", 4: "wind", 5: "earth", 6 : "dark"}
look for:
- self.isShowButton = False
add below:
- if app.ENABLE_VIEW_ELEMENT:self.elementImage = None
inside Destroy method, look for:
add below:
- if app.ENABLE_VIEW_ELEMENT:self.elementImage = None
inside ResetTargetBoard method, look for:
add below:
- if app.ENABLE_VIEW_ELEMENT and self.elementImage:self.elementImage = None
look for :
- def SetElementImage(self,elementId):
add above:
- if app.ENABLE_VIEW_ELEMENT: def SetElementImage(self,elementId): try: if elementId > 0 and elementId in ELEMENT_IMAGE_DIC.keys(): self.elementImage = ui.ImageBox() self.elementImage.SetParent(self.name) self.elementImage.SetPosition(-60,-12) self.elementImage.LoadImage("d:/ymir work/ui/game/12zi/element/%s.sub" % (ELEMENT_IMAGE_DIC[elementId])) self.elementImage.Show() except: pass
Compile server, client source and root pack and that's it!
Enjoy!
Happy halloween!
Bitte melden Sie sich an, um dieses Bild zu sehen.
Bitte melden Sie sich an, um dieses Bild zu sehen.
Bitte melden Sie sich an, um dieses Bild zu sehen.
Bitte melden Sie sich an, um dieses Bild zu sehen.