da **** meint, Teile meines Codes in seinen Produkten, die er verkauft, verwenden zu müssen, habe ich mich nun dazu entschlossen, das ganze zu publizieren.
Das Release bewirkt, dass Items, welche ihr neu erhaltet, im Inventar markiert werden (wie ein aktivierter Auto-Pott).
Einbau
1. Client-Source
Datei: PythonSlotWindow.h (EterPythonLib)
Das 1. suchen und mit dem 2. ersetzen:
Code:
CAniImageBox * m_pSlotActiveEffect;
Code:
CAniImageBox* m_apSlotActiveEffect[3];
Das 1. suchen und mit dem 2. ersetzen:
Code:
if (!m_pSlotActiveEffect)
Code:
if (!m_apSlotActiveEffect[0] || !m_apSlotActiveEffect[1] || !m_apSlotActiveEffect[2])
Code:
if (m_pSlotActiveEffect) m_pSlotActiveEffect->Update();
Code:
for (int i = 0; i < 3; ++i) if (m_apSlotActiveEffect[i]) m_apSlotActiveEffect[i]->Update();
Code:
if (rSlot.bActive) if (m_pSlotActiveEffect) { int ix = m_rect.left + rSlot.ixPosition; int iy = m_rect.top + rSlot.iyPosition; m_pSlotActiveEffect->SetPosition(ix, iy); m_pSlotActiveEffect->Render(); }
Code:
if (rSlot.bActive) { int iSize = ((int)rSlot.byyPlacedItemSize) - 1; if (iSize >= 0 && iSize < 3 && m_apSlotActiveEffect[iSize]) { int ix = m_rect.left + rSlot.ixPosition; int iy = m_rect.top + rSlot.iyPosition; m_apSlotActiveEffect[iSize]->SetPosition(ix, iy); m_apSlotActiveEffect[iSize]->Render(); } }
Code:
m_pSlotActiveEffect = new CAniImageBox(NULL); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/00.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/01.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/02.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/03.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/04.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/05.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/06.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/07.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/08.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/09.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/10.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/11.sub"); m_pSlotActiveEffect->AppendImage("d:/ymir work/ui/public/slotactiveeffect/12.sub"); m_pSlotActiveEffect->SetRenderingMode(CGraphicExpandedImageInstance::RENDERING_MODE_SCREEN); m_pSlotActiveEffect->Show();
Code:
for (int i = 0; i < 3; ++i) { CAniImageBox* pEff = new CAniImageBox(NULL); for (int j = 0; j <= 12; ++j) { char buf[64+1]; sprintf_s(buf, "d:/ymir work/ui/public/slotactiveeffect/slot%d/%02d.sub", (i+1), j); pEff->AppendImage(buf); } pEff->SetRenderingMode(CGraphicExpandedImageInstance::RENDERING_MODE_SCREEN); pEff->Show(); m_apSlotActiveEffect[i] = pEff; }
Code:
if (m_pSlotActiveEffect) { delete m_pSlotActiveEffect; m_pSlotActiveEffect = NULL; }
Code:
for (int i = 0; i < 3; ++i) { if (m_apSlotActiveEffect[i]) { delete m_apSlotActiveEffect[i]; m_apSlotActiveEffect[i] = NULL; } }
Code:
m_pSlotActiveEffect = NULL;
Code:
for (int i = 0; i < 3; ++i) m_apSlotActiveEffect[i] = NULL;
2. Client
Datei: interfaceModule.py
Das 1. suchen und mit dem 2. ersetzen:
Code:
def Highligt_Item(self, inven_type, inven_pos): if player.DRAGON_SOUL_INVENTORY == inven_type: if app.ENABLE_DRAGON_SOUL_SYSTEM: self.wndDragonSoul.HighlightSlot(inven_pos)
Code:
def Highligt_Item(self, inven_type, inven_pos): if player.DRAGON_SOUL_INVENTORY == inven_type: if app.ENABLE_DRAGON_SOUL_SYSTEM: self.wndDragonSoul.HighlightSlot(inven_pos) elif player.SLOT_TYPE_INVENTORY == inven_type: self.wndInventory.HighlightSlot(inven_pos)
Das 1. suchen und mit dem 2. ersetzen:
Code:
class InventoryWindow(ui.ScriptWindow):
Code:
class InventoryWindow(ui.ScriptWindow): liHighlightedItems = []
Code:
def OverInItem(self, overSlotPos): overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos) self.wndItem.SetUsableItem(False) if mouseModule.mouseController.isAttached(): attachedItemType = mouseModule.mouseController.GetAttachedType() if player.SLOT_TYPE_INVENTORY == attachedItemType: attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex() if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos): self.wndItem.SetUsableItem(True) self.ShowToolTip(overSlotPos) return self.ShowToolTip(overSlotPos)
Code:
def OverInItem(self, overSlotPos): overSlotPosGlobal = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos) self.wndItem.SetUsableItem(False) if overSlotPosGlobal in self.liHighlightedItems: self.liHighlightedItems.remove(overSlotPosGlobal) self.wndItem.DeactivateSlot(overSlotPos) if mouseModule.mouseController.isAttached(): attachedItemType = mouseModule.mouseController.GetAttachedType() if player.SLOT_TYPE_INVENTORY == attachedItemType: attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex() if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPosGlobal): self.wndItem.SetUsableItem(True) self.ShowToolTip(overSlotPosGlobal) return self.ShowToolTip(overSlotPosGlobal)
Code:
def RefreshBagSlotWindow(self): # [...] for i in xrange(player.INVENTORY_PAGE_SIZE): # [...] itemVnum = getItemVNum(slotNumber) setItemVNum(i, itemVnum, itemCount) #################### NEW PART #################### if itemVnum == 0 and slotNumber in self.liHighlightedItems: self.liHightlightedItems.remove(slotNumber) ################################################## if constInfo.IS_AUTO_POTION(itemVnum): # [...] #################### NEW PART #################### else: self.wndItem.DeactivateSlot(slotNumber) self.__RefreshHighlights() ################################################## # [...]
Code:
def HighlightSlot(self, slot): if not slot in self.liHighlightedItems: self.liHighlightedItems.append(slot) def __RefreshHighlights(self): for i in xrange(player.INVENTORY_PAGE_SIZE): slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i) if slotNumber in self.liHighlightedItems: self.wndItem.ActivateSlot(i)
3. Server-Source (Game)
Datei: char.h
Das 1. suchen und mit dem 2. ersetzen:
Code:
void SetItem(TItemPos Cell, LPITEM item);
Code:
void SetItem(TItemPos Cell, LPITEM item, bool bWereMine = false);
Das 1. suchen und mit dem 2. ersetzen:
Code:
void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem)
Code:
void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem, bool bWereMine)
Code:
pack.highlight = (Cell.window_type == DRAGON_SOUL_INVENTORY);
Code:
pack.highlight = !bWereMine || (Cell.window_type == DRAGON_SOUL_INVENTORY);
Code:
SetItem(DestCell, item);
Code:
SetItem(DestCell, item, true);
Der Methode CInputDB::ItemLoad(LPDESC d, const char * c_pData) folgendes hinzufügen:
Code:
void CInputDB::ItemLoad(LPDESC d, const char * c_pData) { // [...] for (DWORD i = 0; i < dwCount; ++i, ++p) { LPITEM item = ITEM_MANAGER::instance().CreateItem(p->vnum, p->count, p->id); if (!item) { // [...] } item->SetSkipSave(true); item->SetSockets(p->alSockets); item->SetAttributes(p->aAttr); /********* NEW **********/ item->SetLastOwnerPID(p->owner); /************************/ // [...] if ((p->window == INVENTORY && ch->GetInventoryItem(p->pos)) || (p->window == EQUIPMENT && ch->GetWear(p->pos))) { // [...] } else { // [...] } // [...] } // [...] }
Das 1. suchen und mit dem 2. ersetzen:
Code:
DWORD GetLastOwnerPID() { return m_dwLastOwnerPID; }
Code:
void SetLastOwnerPID(DWORD pid) { m_dwLastOwnerPID = pid; } DWORD GetLastOwnerPID() { return m_dwLastOwnerPID; }
Der Methode CItem::AddToCharacter(LPDESC d, const char * c_pData) folgendes hinzufügen:
Code:
bool CItem::AddToCharacter(LPCHARACTER ch, TItemPos Cell) { // [...] if (INVENTORY == window_type) { // [...] } else if (DRAGON_SOUL_INVENTORY == window_type) { // [...] } /********* NEW *********/ bool bWereMine = this->GetLastOwnerPID() == ch->GetPlayerID(); /***********************/ if (ch->GetDesc()) m_dwLastOwnerPID = ch->GetPlayerID(); event_cancel(&m_pkDestroyEvent); // OLD: ch->SetItem(TItemPos(window_type, pos), this); ch->SetItem(TItemPos(window_type, pos), this, bWereMine); // [...] }
Die Dateien im Anhang in bspw. das ETC Archiv packen in das Verzeichnis D:/ymir work/ui/
Special Thanks geht hierbei an Souza, da er mich dazu gebracht hat, das ganze zu schreiben.
RE-Releases erlaubt und ERWÜNSCHT, solange meine Credits bestehen bleiben!
MfG