Jump to content

xDwin

Member
  • Content Count

    28
  • Joined

  • Last visited

  • Yangs

    268 [ Donate ]

Community Reputation

6 Neutral

About xDwin

  • Rank
    Neutral

Informations

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Working, I couldn't find a proper deviltower. I searched so long. Turkish communities are weak in this regard. They changed everywhere. Can you share it with me? I am aware. I think I should get rid of this dungeon now.
  2. Anyone can help me? It's bad for me.
  3. The person who wrote the quest insisted that the problem did not belong to him and now he is in the military. So, he won't be here for 6 months.
  4. // // * RunState // // decides script to wait for user input, or finish // bool CQuestManager::RunState(QuestState & qs) { ClearError(); m_CurrentRunningState = &qs; int ret = lua_resume(qs.co, qs.args); if (ret == 0) { if (lua_gettop(qs.co) == 0) { // end of quest GotoEndState(qs); return false; } if (!strcmp(lua_tostring(qs.co, 1), "select")) { GotoSelectState(qs); return true; } if (!strcmp(lua_tostring(qs.co, 1), "wait")) { GotoPauseState(qs); return true; } if (!strcmp(lua_tostring(qs.co, 1), "input")) { GotoInputState(qs); return true; } if (!strcmp(lua_tostring(qs.co, 1), "confirm")) { GotoConfirmState(qs); return true; } if (!strcmp(lua_tostring(qs.co, 1), "select_item")) { GotoSelectItemState(qs); return true; } } else { sys_err("LUA_ERROR: %s", lua_tostring(qs.co, 1)); } WriteRunningStateToSyserr(); SetError(); GotoEndState(qs); return false; } Here sir https://paste.ubuntu.com/p/MgqyG7P3Dn/
  5. A group successfully completes the devil's tower, and immediately after it restarts the devil's tower using another channel, the server collapses when it completes the floor to find the right metin stones. https://paste.ubuntu.com/p/MgqyG7P3Dn/ I add the LUA here. BT Full : 1. https://prnt.sc/t9wnh1 2. https://prnt.sc/t9wnwe 3. https://prnt.sc/t9wo4g 4. https://prnt.sc/t9woaa 5. https://prnt.sc/t9woh8
  6. Hey, firstly thanks for your answer & support. I'm glad to answer. It's quest problem or another? Can you help me about it more? Kind Regards
  7. Version of Files : 41027 Hey 1. Description of the problem / Question : I bought the Devil Tower system for 50 Euros. The friend I bought did not help me with the Core I bought in this regard. He argued that the problem was not caused by him. Can anybody help me? 2. SysErr ( Client / Server ) / SysLog ( Server ) Jun 8 19:49:33 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=1097, npc=1302) Jun 8 19:49:33 :: DROP_ITEM: Korku Maskesi +0 247064 733121 from Ağaç Kurbağası Lideri Jun 8 19:49:33 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=1097, npc=1302) Jun 8 19:49:33 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=1097, npc=1305) Jun 8 19:49:33 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=165, npc=8017) Jun 8 19:49:33 :: XXX Dungeon Notice 0x2c036300 Doğru metin bulundu. Jun 8 19:49:33 :: Dungeon GetMapIndex 660004 Jun 8 19:49:33 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=1097, npc=1305) Jun 8 19:49:33 :: GIVE_GOLD: Buse 545 Jun 8 19:49:33 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=1097, npc=1302) Jun 8 19:49:33 :: CQuestManager::Kill QUEST_KILL_EVENT (pc=1097, npc=1302) Jun 8 19:49:33 :: Dungeon GetMapIndex 660004 Jun 8 19:49:33 :: XXX AddServerTimer Devil_5 660004 0x821844c0 Jun 8 19:49:33 :: Dungeon GetMapIndex 660004 Jun 8 19:49:33 :: XXX AddServerTimer Devil_5 660004 0x82184ae SYSERR: Jun 8 19:49:33 :: AddServerTimer: already registered server timer name:Devil_5 arg:660004 3. How to reproduce it ? A group successfully completes the devil's tower, and immediately after it restarts the devil's tower using another channel, the server collapses when it completes the floor to find the right metin stones. 4. Screenshots : https://prnt.sc/t9hdvd https://prnt.sc/t9hf85 Thanks, Sincerly,
  8. Hey guys, I'm fixed right now. I didin't have IPFW in my Live Server. One user attack our Auth Server (Trying login in seconds) After installing IPFW all problem is fixed. Thanks.
  9. Version of Files : 41027 Hello guys again. I have a problem. My game didin't crash or give game.core but I have a problem with Auth. Syserr is : SYSERR: Jun 28 18:08:07 :: socket_accept: accept: Software caused connection abort (fd 12) SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5136 SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5136 SYSERR: Jun 28 18:08:07 :: socket_accept: accept: Software caused connection abort (fd 12) SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5137 SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5137 SYSERR: Jun 28 18:08:07 :: socket_accept: accept: Software caused connection abort (fd 12) SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5138 SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5138 SYSERR: Jun 28 18:08:07 :: socket_accept: accept: Software caused connection abort (fd 12) SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5139 SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5139 SYSERR: Jun 28 18:08:07 :: socket_accept: accept: Software caused connection abort (fd 12) SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5140 SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5140 SYSERR: Jun 28 18:08:07 :: socket_accept: accept: Software caused connection abort (fd 12) SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5141 SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5141 SYSERR: Jun 28 18:08:07 :: socket_accept: accept: Software caused connection abort (fd 12) SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5142 SYSERR: Jun 28 18:08:07 :: fdwatch_add_fd: fd overflow 5142 SYSERR: Jun 28 18:08:07 :: socket_accept: accept: Software caused connection abort (fd 12) SYSERR: Jun 28 18:08:08 :: fdwatch_add_fd: fd overflow 5143 SYSERR: Jun 28 18:08:08 :: fdwatch_add_fd: fd overflow 5143 Can anyone help me? Users can't log-in game sometimes.
  10. Bro! Thank you very much. I think my problem is fixed. I write again, i want the send you my best greetings. But sorry for in 2 days i can't write and log-in board. I have a some hospital problems. Thank you very much. @WeedHex also thank you very much. You were interested in me and you tried to be a solution. I am grateful to you too. @Denis Thank you very much for coming and trying to help when calling for help. @Johnny69 Yes, you made me check and make sure something. Thank you so much. One of my progress was your comment. @xP3NG3Rx I'm a big fan of you. When I had a problem seeing you trying to help me made me feel happy. Thank you so much. @Ikarus_ It is a great pleasure to use your systems. I am grateful to you for your location and for trying to help me. When I first experienced this problem, I researched it from the Internet. There were 3 people in this forum, like me, who had this problem years ago. I think they were people like C ++ without me. This problem scared me a lot. Nobody said that if I was gone, they wouldn't be able to help me, even if they were paid, they wouldn't be able to look at this problem. But Metin2.DEV solved my problem and saved my game. Thank you very much!
  11. When missing products are reloaded, will they disappear again? We prevented the problem that will occur in the future. I haven't tried it yet and I'm going to test it shortly. Can we upload old items differently to players' inventory?
  12. Like this ? https://prnt.sc/t57wx2
  13. Sure friend, thank you #include "stdafx.h" #include <stack> #include "utils.h" #include "config.h" #include "char.h" #include "char_manager.h" #include "item_manager.h" #include "desc.h" #include "desc_client.h" #include "desc_manager.h" #include "packet.h" #include "affect.h" #include "skill.h" #include "start_position.h" #include "mob_manager.h" #include "db.h" #include "log.h" #include "vector.h" #include "buffer_manager.h" #include "questmanager.h" #include "fishing.h" #include "party.h" #include "dungeon.h" #include "refine.h" #include "unique_item.h" #include "war_map.h" #include "xmas_event.h" #include "marriage.h" #include "monarch.h" #include "polymorph.h" #include "blend_item.h" #include "castle.h" #include "BattleArena.h" #include "arena.h" #include "dev_log.h" #include "pcbang.h" #include "threeway_war.h" #include "safebox.h" #include "shop.h" #ifdef ENABLE_NEWSTUFF #include "pvp.h" #endif #ifdef NEW_PET_SYSTEM #include "New_PetSystem.h" #endif #include "../../common/VnumHelper.h" #include "DragonSoul.h" #include "buff_on_attributes.h" #include "belt_inventory_helper.h" #include "../../common/CommonDefines.h" //auction_temp #ifdef __AUCTION__ #include "auction_manager.h" #endif const int ITEM_BROKEN_METIN_VNUM = 28960; #define ENABLE_EFFECT_EXTRAPOT #define ENABLE_BOOKS_STACKFIX // CHANGE_ITEM_ATTRIBUTES // const DWORD CHARACTER::msc_dwDefaultChangeItemAttrCycle = 10; const char CHARACTER::msc_szLastChangeItemAttrFlag[] = "Item.LastChangeItemAttr"; // const char CHARACTER::msc_szChangeItemAttrCycleFlag[] = "change_itemattr_cycle"; // END_OF_CHANGE_ITEM_ATTRIBUTES const BYTE g_aBuffOnAttrPoints[] = { POINT_ENERGY, POINT_COSTUME_ATTR_BONUS }; struct FFindStone { std::map<DWORD, LPCHARACTER> m_mapStone; void operator()(LPENTITY pEnt) { if (pEnt->IsType(ENTITY_CHARACTER) == true) { LPCHARACTER pChar = (LPCHARACTER)pEnt; if (pChar->IsStone() == true) { m_mapStone[(DWORD)pChar->GetVID()] = pChar; } } } }; static bool IS_SUMMON_ITEM(int vnum) { switch (vnum) { case 22000: case 22010: case 22011: case 22020: case ITEM_MARRIAGE_RING: return true; } return false; } static bool IS_MONKEY_DUNGEON(int map_index) { switch (map_index) { case 5: case 25: case 45: case 108: case 109: return true; } return false; } bool IS_SUMMONABLE_ZONE(int map_index) { if (IS_MONKEY_DUNGEON(map_index)) return false; // ¼º if (IS_CASTLE_MAP(map_index)) return false; switch (map_index) { case 66 : case 71 : case 72 : case 73 : case 193 : #if 0 case 184 : case 185 : case 186 : case 187 : case 188 : case 189 : #endif case 216 : case 217 : case 208 : case 113 : // OX Event ¸Ê return false; } if (CBattleArena::IsBattleArenaMap(map_index)) return false; if (map_index > 10000) return false; return true; } bool IS_BOTARYABLE_ZONE(int nMapIndex) { if (!g_bEnableBootaryCheck) return true; switch (nMapIndex) { case 1 : case 3 : case 21 : case 23 : case 41 : case 43 : return true; } return false; } static bool FN_check_item_socket(LPITEM item) { for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { if (item->GetSocket(i) != item->GetProto()->alSockets[i]) return false; } return true; } // item socket º¹»ç -- by mhh static void FN_copy_item_socket(LPITEM dest, LPITEM src) { for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { dest->SetSocket(i, src->GetSocket(i)); } } static bool FN_check_item_sex(LPCHARACTER ch, LPITEM item) { if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_MALE)) { if (SEX_MALE==GET_SEX(ch)) return false; } if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_FEMALE)) { if (SEX_FEMALE==GET_SEX(ch)) return false; } return true; } ///////////////////////////////////////////////////////////////////////////// // ITEM HANDLING ///////////////////////////////////////////////////////////////////////////// bool CHARACTER::CanHandleItem(bool bSkipCheckRefine, bool bSkipObserver) { if (!bSkipObserver) if (m_bIsObserver) return false; if (GetMyShop()) return false; if (!bSkipCheckRefine) if (m_bUnderRefine) return false; if (IsCubeOpen() || NULL != DragonSoul_RefineWindow_GetOpener()) return false; if (IsWarping()) return false; #ifdef ENABLE_ACCE_SYSTEM if ((m_bAcceCombination) || (m_bAcceAbsorption)) return false; #endif return true; } LPITEM CHARACTER::GetInventoryItem(WORD wCell) const { return GetItem(TItemPos(INVENTORY, wCell)); } #ifdef ENABLE_SPECIAL_STORAGE LPITEM CHARACTER::GetUpgradeInventoryItem(WORD wCell) const { return GetItem(TItemPos(UPGRADE_INVENTORY, wCell)); } LPITEM CHARACTER::GetBookInventoryItem(WORD wCell) const { return GetItem(TItemPos(BOOK_INVENTORY, wCell)); } LPITEM CHARACTER::GetStoneInventoryItem(WORD wCell) const { return GetItem(TItemPos(STONE_INVENTORY, wCell)); } LPITEM CHARACTER::GetChestInventoryItem(WORD wCell) const { return GetItem(TItemPos(CHEST_INVENTORY, wCell)); } LPITEM CHARACTER::GetBonusInventoryItem(WORD wCell) const { return GetItem(TItemPos(BONUS_INVENTORY, wCell)); } LPITEM CHARACTER::GetVariusInventoryItem(WORD wCell) const { return GetItem(TItemPos(VARIUS_INVENTORY, wCell)); } #endif LPITEM CHARACTER::GetItem(TItemPos Cell) const { if (!IsValidItemPosition(Cell)) return NULL; WORD wCell = Cell.cell; BYTE window_type = Cell.window_type; switch (window_type) { case INVENTORY: case EQUIPMENT: if (wCell >= INVENTORY_AND_EQUIP_SLOT_MAX) { sys_err("CHARACTER::GetInventoryItem: invalid item cell %d", wCell); return NULL; } return m_pointsInstant.pItems[wCell]; case DRAGON_SOUL_INVENTORY: if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::GetInventoryItem: invalid DS item cell %d", wCell); return NULL; } return m_pointsInstant.pDSItems[wCell]; #ifdef ENABLE_SPECIAL_STORAGE case UPGRADE_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::GetInventoryItem: invalid SSU item cell %d", wCell); return NULL; } return m_pointsInstant.pSSUItems[wCell]; } break; case BOOK_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::GetInventoryItem: invalid SSB item cell %d", wCell); return NULL; } return m_pointsInstant.pSSBItems[wCell]; } break; case STONE_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::GetInventoryItem: invalid SSS item cell %d", wCell); return NULL; } return m_pointsInstant.pSSSItems[wCell]; } break; case CHEST_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::GetInventoryItem: invalid SSC item cell %d", wCell); return NULL; } return m_pointsInstant.pSSCItems[wCell]; } break; case BONUS_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::GetInventoryItem: invalid SSCB item cell %d", wCell); return NULL; } return m_pointsInstant.pSSCBItems[wCell]; } break; case VARIUS_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::GetInventoryItem: invalid SSV item cell %d", wCell); return NULL; } return m_pointsInstant.pSSVItems[wCell]; } break; #endif default: return NULL; } return NULL; } #ifdef ENABLE_HIGHLIGHT_NEW_ITEM void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem, bool bWereMine) #else void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem) #endif { WORD wCell = Cell.cell; BYTE window_type = Cell.window_type; if ((unsigned long)((CItem*)pItem) == 0xff || (unsigned long)((CItem*)pItem) == 0xffffffff) { sys_err("!!! FATAL ERROR !!! item == 0xff (char: %s cell: %u)", GetName(), wCell); core_dump(); return; } if (pItem && pItem->GetOwner()) { assert(!"GetOwner exist"); return; } switch(window_type) { case INVENTORY: case EQUIPMENT: { if (wCell >= INVENTORY_AND_EQUIP_SLOT_MAX) { sys_err("CHARACTER::SetItem: invalid item cell %d", wCell); return; } LPITEM pOld = m_pointsInstant.pItems[wCell]; if (pOld) { if (wCell < INVENTORY_MAX_NUM) { for (int i = 0; i < pOld->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= INVENTORY_MAX_NUM) continue; if (m_pointsInstant.pItems[p] && m_pointsInstant.pItems[p] != pOld) continue; m_pointsInstant.bItemGrid[p] = 0; } } else m_pointsInstant.bItemGrid[wCell] = 0; } if (pItem) { if (wCell < INVENTORY_MAX_NUM) { for (int i = 0; i < pItem->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= INVENTORY_MAX_NUM) continue; m_pointsInstant.bItemGrid[p] = wCell + 1; } } else m_pointsInstant.bItemGrid[wCell] = wCell + 1; } m_pointsInstant.pItems[wCell] = pItem; } break; case DRAGON_SOUL_INVENTORY: { LPITEM pOld = m_pointsInstant.pDSItems[wCell]; if (pOld) { if (wCell < DRAGON_SOUL_INVENTORY_MAX_NUM) { for (int i = 0; i < pOld->GetSize(); ++i) { int p = wCell + (i * DRAGON_SOUL_BOX_COLUMN_NUM); if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM) continue; if (m_pointsInstant.pDSItems[p] && m_pointsInstant.pDSItems[p] != pOld) continue; m_pointsInstant.wDSItemGrid[p] = 0; } } else m_pointsInstant.wDSItemGrid[wCell] = 0; } if (pItem) { if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::SetItem: invalid DS item cell %d", wCell); return; } if (wCell < DRAGON_SOUL_INVENTORY_MAX_NUM) { for (int i = 0; i < pItem->GetSize(); ++i) { int p = wCell + (i * DRAGON_SOUL_BOX_COLUMN_NUM); if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM) continue; m_pointsInstant.wDSItemGrid[p] = wCell + 1; } } else m_pointsInstant.wDSItemGrid[wCell] = wCell + 1; } m_pointsInstant.pDSItems[wCell] = pItem; } break; #ifdef ENABLE_SPECIAL_STORAGE case UPGRADE_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::SetItem: invalid UPGRADE_INVENTORY item cell %d", wCell); return; } LPITEM pOld = m_pointsInstant.pSSUItems[wCell]; if (pOld) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pOld->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; if (m_pointsInstant.pSSUItems[p] && m_pointsInstant.pSSUItems[p] != pOld) continue; m_pointsInstant.wSSUItemGrid[p] = 0; } } else m_pointsInstant.wSSUItemGrid[wCell] = 0; } if (pItem) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pItem->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; m_pointsInstant.wSSUItemGrid[p] = wCell + 1; } } else m_pointsInstant.wSSUItemGrid[wCell] = wCell + 1; } m_pointsInstant.pSSUItems[wCell] = pItem; } break; case BOOK_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::SetItem: invalid BOOK_INVENTORY item cell %d", wCell); return; } LPITEM pOld = m_pointsInstant.pSSBItems[wCell]; if (pOld) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pOld->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; if (m_pointsInstant.pSSBItems[p] && m_pointsInstant.pSSBItems[p] != pOld) continue; m_pointsInstant.wSSBItemGrid[p] = 0; } } else m_pointsInstant.wSSBItemGrid[wCell] = 0; } if (pItem) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pItem->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; m_pointsInstant.wSSBItemGrid[p] = wCell + 1; } } else m_pointsInstant.wSSBItemGrid[wCell] = wCell + 1; } m_pointsInstant.pSSBItems[wCell] = pItem; } break; case STONE_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::SetItem: invalid STONE_INVENTORY item cell %d", wCell); return; } LPITEM pOld = m_pointsInstant.pSSSItems[wCell]; if (pOld) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pOld->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; if (m_pointsInstant.pSSSItems[p] && m_pointsInstant.pSSSItems[p] != pOld) continue; m_pointsInstant.wSSSItemGrid[p] = 0; } } else m_pointsInstant.wSSSItemGrid[wCell] = 0; } if (pItem) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pItem->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; m_pointsInstant.wSSSItemGrid[p] = wCell + 1; } } else m_pointsInstant.wSSSItemGrid[wCell] = wCell + 1; } m_pointsInstant.pSSSItems[wCell] = pItem; } break; case CHEST_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::SetItem: invalid CHEST_INVENTORY item cell %d", wCell); return; } LPITEM pOld = m_pointsInstant.pSSCItems[wCell]; if (pOld) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pOld->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; if (m_pointsInstant.pSSCItems[p] && m_pointsInstant.pSSCItems[p] != pOld) continue; m_pointsInstant.wSSCItemGrid[p] = 0; } } else m_pointsInstant.wSSCItemGrid[wCell] = 0; } if (pItem) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pItem->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; m_pointsInstant.wSSCItemGrid[p] = wCell + 1; } } else m_pointsInstant.wSSCItemGrid[wCell] = wCell + 1; } m_pointsInstant.pSSCItems[wCell] = pItem; } break; case BONUS_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::SetItem: invalid BONUS_INVENTORY item cell %d", wCell); return; } LPITEM pOld = m_pointsInstant.pSSCBItems[wCell]; if (pOld) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pOld->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; if (m_pointsInstant.pSSCBItems[p] && m_pointsInstant.pSSCBItems[p] != pOld) continue; m_pointsInstant.wSSCBItemGrid[p] = 0; } } else m_pointsInstant.wSSCBItemGrid[wCell] = 0; } if (pItem) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pItem->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; m_pointsInstant.wSSCBItemGrid[p] = wCell + 1; } } else m_pointsInstant.wSSCBItemGrid[wCell] = wCell + 1; } m_pointsInstant.pSSCBItems[wCell] = pItem; } break; case VARIUS_INVENTORY: { if (wCell >= SPECIAL_INVENTORY_MAX_NUM) { sys_err("CHARACTER::SetItem: invalid VARIUS_INVENTORY item cell %d", wCell); return; } LPITEM pOld = m_pointsInstant.pSSVItems[wCell]; if (pOld) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pOld->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; if (m_pointsInstant.pSSVItems[p] && m_pointsInstant.pSSVItems[p] != pOld) continue; m_pointsInstant.wSSVItemGrid[p] = 0; } } else m_pointsInstant.wSSVItemGrid[wCell] = 0; } if (pItem) { if (wCell < SPECIAL_INVENTORY_MAX_NUM) { for (int i = 0; i < pItem->GetSize(); ++i) { int p = wCell + (i * 5); if (p >= SPECIAL_INVENTORY_MAX_NUM) continue; m_pointsInstant.wSSVItemGrid[p] = wCell + 1; } } else m_pointsInstant.wSSVItemGrid[wCell] = wCell + 1; } m_pointsInstant.pSSVItems[wCell] = pItem; } break; #endif default: sys_err ("Invalid Inventory type %d", window_type); return; } if (GetDesc()) { if (pItem) { TPacketGCItemSet pack; pack.header = HEADER_GC_ITEM_SET; pack.Cell = Cell; pack.count = pItem->GetCount(); pack.vnum = pItem->GetVnum(); pack.flags = pItem->GetFlag(); pack.anti_flags = pItem->GetAntiFlag(); #ifdef ENABLE_HIGHLIGHT_NEW_ITEM pack.highlight = !bWereMine || (Cell.window_type == DRAGON_SOUL_INVENTORY);(Cell.window_type == DRAGON_SOUL_INVENTORY); #else pack.highlight = (Cell.window_type == DRAGON_SOUL_INVENTORY); #endif thecore_memcpy(pack.alSockets, pItem->GetSockets(), sizeof(pack.alSockets)); thecore_memcpy(pack.aAttr, pItem->GetAttributes(), sizeof(pack.aAttr)); GetDesc()->Packet(&pack, sizeof(TPacketGCItemSet)); } else { TPacketGCItemDelDeprecated pack; pack.header = HEADER_GC_ITEM_DEL; pack.Cell = Cell; pack.count = 0; pack.vnum = 0; memset(pack.alSockets, 0, sizeof(pack.alSockets)); memset(pack.aAttr, 0, sizeof(pack.aAttr)); GetDesc()->Packet(&pack, sizeof(TPacketGCItemDelDeprecated)); } } if (pItem) { pItem->SetCell(this, wCell); switch (window_type) { case INVENTORY: case EQUIPMENT: if ((wCell < INVENTORY_MAX_NUM) || (BELT_INVENTORY_SLOT_START <= wCell && BELT_INVENTORY_SLOT_END > wCell)) pItem->SetWindow(INVENTORY); else pItem->SetWindow(EQUIPMENT); break; case DRAGON_SOUL_INVENTORY: pItem->SetWindow(DRAGON_SOUL_INVENTORY); break; #ifdef ENABLE_SPECIAL_STORAGE case UPGRADE_INVENTORY: pItem->SetWindow(UPGRADE_INVENTORY); break; case BOOK_INVENTORY: pItem->SetWindow(BOOK_INVENTORY); break; case STONE_INVENTORY: pItem->SetWindow(STONE_INVENTORY); break; case CHEST_INVENTORY: pItem->SetWindow(CHEST_INVENTORY); break; case BONUS_INVENTORY: pItem->SetWindow(BONUS_INVENTORY); break; case VARIUS_INVENTORY: pItem->SetWindow(VARIUS_INVENTORY); break; #endif } } } LPITEM CHARACTER::GetWear(BYTE bCell) const { if (bCell >= WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX) { sys_err("CHARACTER::GetWear: invalid wear cell %d", bCell); return NULL; } return m_pointsInstant.pItems[INVENTORY_MAX_NUM + bCell]; } void CHARACTER::SetWear(BYTE bCell, LPITEM item) { if (bCell >= WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX) { sys_err("CHARACTER::SetItem: invalid item cell %d", bCell); return; } SetItem(TItemPos (INVENTORY, INVENTORY_MAX_NUM + bCell), item); if (!item && bCell == WEAR_WEAPON) { if (IsAffectFlag(AFF_GWIGUM)) RemoveAffect(SKILL_GWIGEOM); if (IsAffectFlag(AFF_GEOMGYEONG)) RemoveAffect(SKILL_GEOMKYUNG); } } void CHARACTER::ClearItem() { int i; LPITEM item; for (i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i) { if ((item = GetInventoryItem(i))) { item->SetSkipSave(true); ITEM_MANAGER::instance().FlushDelayedSave(item); item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255); } } for (i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; ++i) { if ((item = GetItem(TItemPos(DRAGON_SOUL_INVENTORY, i)))) { item->SetSkipSave(true); ITEM_MANAGER::instance().FlushDelayedSave(item); item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); } } #ifdef ENABLE_SPECIAL_STORAGE for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { if ((item = GetItem(TItemPos(UPGRADE_INVENTORY, i)))) { item->SetSkipSave(true); ITEM_MANAGER::instance().FlushDelayedSave(item); item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); } } for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { if ((item = GetItem(TItemPos(BOOK_INVENTORY, i)))) { item->SetSkipSave(true); ITEM_MANAGER::instance().FlushDelayedSave(item); item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); } } for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { if ((item = GetItem(TItemPos(STONE_INVENTORY, i)))) { item->SetSkipSave(true); ITEM_MANAGER::instance().FlushDelayedSave(item); item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); } } for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { if ((item = GetItem(TItemPos(CHEST_INVENTORY, i)))) { item->SetSkipSave(true); ITEM_MANAGER::instance().FlushDelayedSave(item); item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); } } for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { if ((item = GetItem(TItemPos(BONUS_INVENTORY, i)))) { item->SetSkipSave(true); ITEM_MANAGER::instance().FlushDelayedSave(item); item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); } } for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { if ((item = GetItem(TItemPos(VARIUS_INVENTORY, i)))) { item->SetSkipSave(true); ITEM_MANAGER::instance().FlushDelayedSave(item); item->RemoveFromCharacter(); M2_DESTROY_ITEM(item); } } #endif } bool CHARACTER::IsEmptyItemGrid(TItemPos Cell, BYTE bSize, int iExceptionCell) const { switch (Cell.window_type) { case INVENTORY: { WORD bCell = Cell.cell; ++iExceptionCell; if (Cell.IsBeltInventoryPosition()) { LPITEM beltItem = GetWear(WEAR_BELT); if (NULL == beltItem) return false; if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0))) return false; if (m_pointsInstant.bItemGrid[bCell]) { if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell) return true; return false; } if (bSize == 1) return true; } else if (bCell >= INVENTORY_MAX_NUM) return false; if (m_pointsInstant.bItemGrid[bCell]) { if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell) { if (bSize == 1) return true; int j = 1; BYTE bPage = bCell / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT); do { BYTE p = bCell + (5 * j); if (p >= INVENTORY_MAX_NUM) return false; if (p / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT) != bPage) return false; if (m_pointsInstant.bItemGrid[p]) if (m_pointsInstant.bItemGrid[p] != iExceptionCell) return false; } while (++j < bSize); return true; } else return false; } // u?? 1??? ??i?? ??????? ?????? ??? ???? if (1 == bSize) return true; else { int j = 1; BYTE bPage = bCell / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT); do { BYTE p = bCell + (5 * j); if (p >= INVENTORY_MAX_NUM) return false; if (p / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT) != bPage) return false; if (m_pointsInstant.bItemGrid[p]) if (m_pointsInstant.bItemGrid[p] != iExceptionCell) return false; } while (++j < bSize); return true; } } break; case DRAGON_SOUL_INVENTORY: { WORD wCell = Cell.cell; if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM) return false; // bItemCell?? 0?? false???? ??Ÿ???? ???? + 1 ??? ó?????. // ???? iExceptionCell?? 1?? ???? ?????. iExceptionCell++; if (m_pointsInstant.wDSItemGrid[wCell]) { if (m_pointsInstant.wDSItemGrid[wCell] == iExceptionCell) { if (bSize == 1) return true; int j = 1; do { int p = wCell + (DRAGON_SOUL_BOX_COLUMN_NUM * j); if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.wDSItemGrid[p]) if (m_pointsInstant.wDSItemGrid[p] != iExceptionCell) return false; } while (++j < bSize); return true; } else return false; } // u?? 1??? ??i?? ??????? ?????? ??? ???? if (1 == bSize) return true; else { int j = 1; do { int p = wCell + (DRAGON_SOUL_BOX_COLUMN_NUM * j); if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.bItemGrid[p]) if (m_pointsInstant.wDSItemGrid[p] != iExceptionCell) return false; } while (++j < bSize); return true; } } #ifdef ENABLE_SPECIAL_STORAGE break; case UPGRADE_INVENTORY: { WORD wCell = Cell.cell; if (wCell >= SPECIAL_INVENTORY_MAX_NUM) return false; iExceptionCell++; if (m_pointsInstant.wSSUItemGrid[wCell]) { if (m_pointsInstant.wSSUItemGrid[wCell] == iExceptionCell) { if (bSize == 1) return true; int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.wSSUItemGrid[p]) { if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } else return false; } if (1 == bSize) return true; else { int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.bItemGrid[p]) { if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } } break; case BOOK_INVENTORY: { WORD wCell = Cell.cell; if (wCell >= SPECIAL_INVENTORY_MAX_NUM) return false; iExceptionCell++; if (m_pointsInstant.wSSBItemGrid[wCell]) { if (m_pointsInstant.wSSBItemGrid[wCell] == iExceptionCell) { if (bSize == 1) return true; int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.wSSBItemGrid[p]) { if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } else return false; } if (1 == bSize) return true; else { int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.bItemGrid[p]) { if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } } break; case STONE_INVENTORY: { WORD wCell = Cell.cell; if (wCell >= SPECIAL_INVENTORY_MAX_NUM) return false; iExceptionCell++; if (m_pointsInstant.wSSSItemGrid[wCell]) { if (m_pointsInstant.wSSSItemGrid[wCell] == iExceptionCell) { if (bSize == 1) return true; int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.wSSSItemGrid[p]) { if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } else return false; } if (1 == bSize) return true; else { int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.bItemGrid[p]) { if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } } break; case CHEST_INVENTORY: { WORD wCell = Cell.cell; if (wCell >= SPECIAL_INVENTORY_MAX_NUM) return false; iExceptionCell++; if (m_pointsInstant.wSSCItemGrid[wCell]) { if (m_pointsInstant.wSSCItemGrid[wCell] == iExceptionCell) { if (bSize == 1) return true; int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.wSSCItemGrid[p]) { if (m_pointsInstant.wSSCItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } else return false; } if (1 == bSize) return true; else { int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.bItemGrid[p]) { if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } } break; case BONUS_INVENTORY: { WORD wCell = Cell.cell; if (wCell >= SPECIAL_INVENTORY_MAX_NUM) return false; iExceptionCell++; if (m_pointsInstant.wSSCBItemGrid[wCell]) { if (m_pointsInstant.wSSCBItemGrid[wCell] == iExceptionCell) { if (bSize == 1) return true; int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.wSSCBItemGrid[p]) { if (m_pointsInstant.wSSCBItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } else return false; } if (1 == bSize) return true; else { int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.bItemGrid[p]) { if (m_pointsInstant.wSSCBItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } } break; case VARIUS_INVENTORY: { WORD wCell = Cell.cell; if (wCell >= SPECIAL_INVENTORY_MAX_NUM) return false; iExceptionCell++; if (m_pointsInstant.wSSVItemGrid[wCell]) { if (m_pointsInstant.wSSVItemGrid[wCell] == iExceptionCell) { if (bSize == 1) return true; int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.wSSVItemGrid[p]) { if (m_pointsInstant.wSSVItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } else return false; } if (1 == bSize) return true; else { int j = 1; do { int p = wCell + (5 * j); if (p >= SPECIAL_INVENTORY_MAX_NUM) return false; if (m_pointsInstant.bItemGrid[p]) { if (m_pointsInstant.wSSVItemGrid[p] != iExceptionCell) return false; } } while (++j < bSize); return true; } } break; #endif } return false; } int CHARACTER::GetEmptyInventory(BYTE size) const { for ( int i = 0; i < INVENTORY_MAX_NUM; ++i) if (IsEmptyItemGrid(TItemPos (INVENTORY, i), size)) return i; return -1; } int CHARACTER::GetEmptyDragonSoulInventory(LPITEM pItem) const { if (NULL == pItem || !pItem->IsDragonSoul()) return -1; if (!DragonSoul_IsQualified()) { return -1; } BYTE bSize = pItem->GetSize(); WORD wBaseCell = DSManager::instance().GetBasePosition(pItem); if (WORD_MAX == wBaseCell) return -1; for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; ++i) if (IsEmptyItemGrid(TItemPos(DRAGON_SOUL_INVENTORY, i + wBaseCell), bSize)) return i + wBaseCell; return -1; } void CHARACTER::CopyDragonSoulItemGrid(std::vector<WORD>& vDragonSoulItemGrid) const { vDragonSoulItemGrid.resize(DRAGON_SOUL_INVENTORY_MAX_NUM); std::copy(m_pointsInstant.wDSItemGrid, m_pointsInstant.wDSItemGrid + DRAGON_SOUL_INVENTORY_MAX_NUM, vDragonSoulItemGrid.begin()); } #ifdef ENABLE_SPECIAL_STORAGE int CHARACTER::GetEmptyUpgradeInventory(LPITEM pItem) const { if (NULL == pItem || !pItem->IsUpgradeItem()) return -1; BYTE bSize = pItem->GetSize(); for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (IsEmptyItemGrid(TItemPos (UPGRADE_INVENTORY, i), bSize)) return i; return -1; } int CHARACTER::GetEmptyBookInventory(LPITEM pItem) const { if (NULL == pItem || !pItem->IsBook()) return -1; BYTE bSize = pItem->GetSize(); for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (IsEmptyItemGrid(TItemPos (BOOK_INVENTORY, i), bSize)) return i; return -1; } int CHARACTER::GetEmptyStoneInventory(LPITEM pItem) const { if (NULL == pItem || !pItem->IsStone()) return -1; BYTE bSize = pItem->GetSize(); for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (IsEmptyItemGrid(TItemPos (STONE_INVENTORY, i), bSize)) return i; return -1; } int CHARACTER::GetEmptyChestInventory(LPITEM pItem) const { if (NULL == pItem || !pItem->IsChest()) return -1; BYTE bSize = pItem->GetSize(); for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (IsEmptyItemGrid(TItemPos (CHEST_INVENTORY, i), bSize)) return i; return -1; } int CHARACTER::GetEmptyBonusInventory(LPITEM pItem) const { if (NULL == pItem || !pItem->IsBonus()) return -1; BYTE bSize = pItem->GetSize(); for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (IsEmptyItemGrid(TItemPos (BONUS_INVENTORY, i), bSize)) return i; return -1; } int CHARACTER::GetEmptyVariusInventory(LPITEM pItem) const { if (NULL == pItem || !pItem->IsVarius()) return -1; BYTE bSize = pItem->GetSize(); for ( int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (IsEmptyItemGrid(TItemPos (VARIUS_INVENTORY, i), bSize)) return i; return -1; } #endif #ifdef ENABLE_SPLIT_EXTENDED int CHARACTER::GetEmptyInventoryFromIndex(WORD index, BYTE itemSize) const { if (index > INVENTORY_MAX_NUM) return -1; for (WORD i = index; i < INVENTORY_MAX_NUM; ++i) if (IsEmptyItemGrid(TItemPos (INVENTORY, i), itemSize)) return i; return -1; } #endif int CHARACTER::CountEmptyInventory() const { int count = 0; for (int i = 0; i < INVENTORY_MAX_NUM; ++i) if (GetInventoryItem(i)) count += GetInventoryItem(i)->GetSize(); return (INVENTORY_MAX_NUM - count); } void TransformRefineItem(LPITEM pkOldItem, LPITEM pkNewItem) { // ACCESSORY_REFINE if (pkOldItem->IsAccessoryForSocket()) { for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { pkNewItem->SetSocket(i, pkOldItem->GetSocket(i)); } //pkNewItem->StartAccessorySocketExpireEvent(); } // END_OF_ACCESSORY_REFINE else { for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { if (!pkOldItem->GetSocket(i)) break; else pkNewItem->SetSocket(i, 1); } int slot = 0; for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { long socket = pkOldItem->GetSocket(i); if (socket > 2 && socket != ITEM_BROKEN_METIN_VNUM) pkNewItem->SetSocket(slot++, socket); } } pkOldItem->CopyAttributeTo(pkNewItem); } void NotifyRefineSuccess(LPCHARACTER ch, LPITEM item, const char* way) { if (NULL != ch && item != NULL) { ch->ChatPacket(CHAT_TYPE_COMMAND, "RefineSuceeded"); LogManager::instance().RefineLog(ch->GetPlayerID(), item->GetName(), item->GetID(), item->GetRefineLevel(), 1, way); } } void NotifyRefineFail(LPCHARACTER ch, LPITEM item, const char* way, int success = 0) { if (NULL != ch && NULL != item) { ch->ChatPacket(CHAT_TYPE_COMMAND, "RefineFailed"); LogManager::instance().RefineLog(ch->GetPlayerID(), item->GetName(), item->GetID(), item->GetRefineLevel(), success, way); } } void CHARACTER::SetRefineNPC(LPCHARACTER ch) { if ( ch != NULL ) { m_dwRefineNPCVID = ch->GetVID(); } else { m_dwRefineNPCVID = 0; } } bool CHARACTER::DoRefine(LPITEM item, bool bMoneyOnly) { if (!CanHandleItem(true)) { ClearRefineMode(); return false; } if (quest::CQuestManager::instance().GetEventFlag("update_refine_time") != 0) { if (get_global_time() < quest::CQuestManager::instance().GetEventFlag("update_refine_time") + (60 * 5)) { sys_log(0, "can't refine %d %s", GetPlayerID(), GetName()); return false; } } const TRefineTable * prt = CRefineManager::instance().GetRefineRecipe(item->GetRefineSet()); if (!prt) return false; DWORD result_vnum = item->GetRefinedVnum(); // REFINE_COST int cost = ComputeRefineFee(prt->cost); int RefineChance = GetQuestFlag("main_quest_lv7.refine_chance"); if (RefineChance > 0) { if (!item->CheckItemUseLevel(20) || item->GetType() != ITEM_WEAPON) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹«·á °³·® ±âȸ´Â 20 ÀÌÇÏÀÇ ¹«±â¸¸ °¡´ÉÇÕ´Ï´Ù")); return false; } cost = 0; SetQuestFlag("main_quest_lv7.refine_chance", RefineChance - 1); } // END_OF_REFINE_COST if (result_vnum == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (item->GetType() == ITEM_USE && item->GetSubType() == USE_TUNING) return false; TItemTable * pProto = ITEM_MANAGER::instance().GetTable(item->GetRefinedVnum()); if (!pProto) { sys_err("DoRefine NOT GET ITEM PROTO %d", item->GetRefinedVnum()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } // REFINE_COST if (GetGold() < cost) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³·®À» Çϱâ À§ÇÑ µ·ÀÌ ºÎÁ·ÇÕ´Ï´Ù.")); return false; } if (!bMoneyOnly && !RefineChance) { for (int i = 0; i < prt->material_count; ++i) { #ifdef ENABLE_PENDANT if (CountSpecifyItem(prt->materials[i].vnum, item->GetCell()) < prt->materials[i].count) #else if (CountSpecifyItem(prt->materials[i].vnum) < prt->materials[i].count) #endif { if (test_server) { ChatPacket(CHAT_TYPE_INFO, "Find %d, count %d, require %d", prt->materials[i].vnum, CountSpecifyItem(prt->materials[i].vnum), prt->materials[i].count); } ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³·®À» Çϱâ À§ÇÑ Àç·á°¡ ºÎÁ·ÇÕ´Ï´Ù.")); return false; } } for (int i = 0; i < prt->material_count; ++i) { #ifdef ENABLE_PENDANT RemoveSpecifyItem(prt->materials[i].vnum, prt->materials[i].count, item->GetCell()); #else RemoveSpecifyItem(prt->materials[i].vnum, prt->materials[i].count); #endif } } int prob = number(1, 100); if (IsRefineThroughGuild() || bMoneyOnly) prob -= 10; // END_OF_REFINE_COST if (prob <= prt->prob) { LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_vnum, 1, 0, false); if (pkNewItem) { ITEM_MANAGER::CopyAllAttrTo(item, pkNewItem); LogManager::instance().ItemLog(this, pkNewItem, "REFINE SUCCESS", pkNewItem->GetName()); BYTE bCell = item->GetCell(); // DETAIL_REFINE_LOG NotifyRefineSuccess(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER"); DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, item->GetVnum(), -cost); ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE SUCCESS)"); // END_OF_DETAIL_REFINE_LOG pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell)); ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem); sys_log(0, "Refine Success %d", cost); pkNewItem->AttrLog(); //PointChange(POINT_GOLD, -cost); sys_log(0, "PayPee %d", cost); PayRefineFee(cost); sys_log(0, "PayPee End %d", cost); } else { // DETAIL_REFINE_LOG sys_err("cannot create item %u", result_vnum); NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER"); // END_OF_DETAIL_REFINE_LOG } } else { DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, item->GetVnum(), -cost); NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER"); item->AttrLog(); ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE FAIL)"); //PointChange(POINT_GOLD, -cost); PayRefineFee(cost); } return true; } enum enum_RefineScrolls { CHUKBOK_SCROLL = 0, HYUNIRON_CHN = 1, YONGSIN_SCROLL = 2, MUSIN_SCROLL = 3, YAGONG_SCROLL = 4, MEMO_SCROLL = 5, BDRAGON_SCROLL = 6, }; bool CHARACTER::DoRefineWithScroll(LPITEM item) { if (!CanHandleItem(true)) { ClearRefineMode(); return false; } ClearRefineMode(); if (quest::CQuestManager::instance().GetEventFlag("update_refine_time") != 0) { if (get_global_time() < quest::CQuestManager::instance().GetEventFlag("update_refine_time") + (60 * 5)) { sys_log(0, "can't refine %d %s", GetPlayerID(), GetName()); return false; } } const TRefineTable * prt = CRefineManager::instance().GetRefineRecipe(item->GetRefineSet()); if (!prt) return false; LPITEM pkItemScroll; #ifdef ENABLE_SPECIAL_STORAGE if (m_srcScroll.cell < 0) #else if (m_iRefineAdditionalCell < 0) #endif return false; #ifdef ENABLE_SPECIAL_STORAGE pkItemScroll = GetItem(m_srcScroll); #else pkItemScroll = GetInventoryItem(m_iRefineAdditionalCell); #endif if (!pkItemScroll) return false; if (!(pkItemScroll->GetType() == ITEM_USE && pkItemScroll->GetSubType() == USE_TUNING)) return false; if (pkItemScroll->GetVnum() == item->GetVnum()) return false; DWORD result_vnum = item->GetRefinedVnum(); DWORD result_fail_vnum = item->GetRefineFromVnum(); if (result_vnum == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } // MUSIN_SCROLL if (pkItemScroll->GetValue(0) == MUSIN_SCROLL) { if (item->GetRefineLevel() >= 4) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ °³·®¼­·Î ´õ ÀÌ»ó °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } } // END_OF_MUSIC_SCROLL else if (pkItemScroll->GetValue(0) == MEMO_SCROLL) { if (item->GetRefineLevel() != pkItemScroll->GetValue(1)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ °³·®¼­·Î °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } } else if (pkItemScroll->GetValue(0) == BDRAGON_SCROLL) { if (item->GetType() != ITEM_METIN || item->GetRefineLevel() != 4) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀ¸·Î °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } } TItemTable * pProto = ITEM_MANAGER::instance().GetTable(item->GetRefinedVnum()); if (!pProto) { sys_err("DoRefineWithScroll NOT GET ITEM PROTO %d", item->GetRefinedVnum()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (GetGold() < prt->cost) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³·®À» Çϱâ À§ÇÑ µ·ÀÌ ºÎÁ·ÇÕ´Ï´Ù.")); return false; } for (int i = 0; i < prt->material_count; ++i) { #ifdef ENABLE_PENDANT if (CountSpecifyItem(prt->materials[i].vnum, item->GetCell()) < prt->materials[i].count) #else if (CountSpecifyItem(prt->materials[i].vnum) < prt->materials[i].count) #endif { if (test_server) { ChatPacket(CHAT_TYPE_INFO, "Find %d, count %d, require %d", prt->materials[i].vnum, CountSpecifyItem(prt->materials[i].vnum), prt->materials[i].count); } ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³·®À» Çϱâ À§ÇÑ Àç·á°¡ ºÎÁ·ÇÕ´Ï´Ù.")); return false; } } for (int i = 0; i < prt->material_count; ++i) { #ifdef ENABLE_PENDANT RemoveSpecifyItem(prt->materials[i].vnum, prt->materials[i].count, item->GetCell()); #else RemoveSpecifyItem(prt->materials[i].vnum, prt->materials[i].count); #endif } int prob = number(1, 100); int success_prob = prt->prob; bool bDestroyWhenFail = false; const char* szRefineType = "SCROLL"; if (pkItemScroll->GetValue(0) == HYUNIRON_CHN || pkItemScroll->GetValue(0) == YONGSIN_SCROLL || pkItemScroll->GetValue(0) == YAGONG_SCROLL) { const char hyuniron_prob[9] = { 100, 75, 65, 55, 45, 40, 35, 25, 20 }; const char yagong_prob[9] = { 100, 100, 90, 80, 70, 60, 50, 30, 20 }; if (pkItemScroll->GetValue(0) == YONGSIN_SCROLL) { success_prob = hyuniron_prob[MINMAX(0, item->GetRefineLevel(), 8)]; } else if (pkItemScroll->GetValue(0) == YAGONG_SCROLL) { success_prob = yagong_prob[MINMAX(0, item->GetRefineLevel(), 8)]; } else if (pkItemScroll->GetValue(0) == HYUNIRON_CHN) {} // @fixme121 else { sys_err("REFINE : Unknown refine scroll item. Value0: %d", pkItemScroll->GetValue(0)); } if (test_server) { ChatPacket(CHAT_TYPE_INFO, "[Only Test] Success_Prob %d, RefineLevel %d ", success_prob, item->GetRefineLevel()); } if (pkItemScroll->GetValue(0) == HYUNIRON_CHN) bDestroyWhenFail = true; // DETAIL_REFINE_LOG if (pkItemScroll->GetValue(0) == HYUNIRON_CHN) { szRefineType = "HYUNIRON"; } else if (pkItemScroll->GetValue(0) == YONGSIN_SCROLL) { szRefineType = "GOD_SCROLL"; } else if (pkItemScroll->GetValue(0) == YAGONG_SCROLL) { szRefineType = "YAGONG_SCROLL"; } // END_OF_DETAIL_REFINE_LOG } // DETAIL_REFINE_LOG if (pkItemScroll->GetValue(0) == MUSIN_SCROLL) { success_prob = 100; szRefineType = "MUSIN_SCROLL"; } // END_OF_DETAIL_REFINE_LOG else if (pkItemScroll->GetValue(0) == MEMO_SCROLL) { success_prob = 100; szRefineType = "MEMO_SCROLL"; } else if (pkItemScroll->GetValue(0) == BDRAGON_SCROLL) { success_prob = 80; szRefineType = "BDRAGON_SCROLL"; } pkItemScroll->SetCount(pkItemScroll->GetCount() - 1); if (prob <= success_prob) { LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_vnum, 1, 0, false); if (pkNewItem) { ITEM_MANAGER::CopyAllAttrTo(item, pkNewItem); LogManager::instance().ItemLog(this, pkNewItem, "REFINE SUCCESS", pkNewItem->GetName()); BYTE bCell = item->GetCell(); NotifyRefineSuccess(this, item, szRefineType); DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, item->GetVnum(), -prt->cost); ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE SUCCESS)"); pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell)); ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem); pkNewItem->AttrLog(); //PointChange(POINT_GOLD, -prt->cost); PayRefineFee(prt->cost); } else { sys_err("cannot create item %u", result_vnum); NotifyRefineFail(this, item, szRefineType); } } else if (!bDestroyWhenFail && result_fail_vnum) { LPITEM pkNewItem = ITEM_MANAGER::instance().CreateItem(result_fail_vnum, 1, 0, false); if (pkNewItem) { ITEM_MANAGER::CopyAllAttrTo(item, pkNewItem); LogManager::instance().ItemLog(this, pkNewItem, "REFINE FAIL", pkNewItem->GetName()); BYTE bCell = item->GetCell(); DBManager::instance().SendMoneyLog(MONEY_LOG_REFINE, item->GetVnum(), -prt->cost); NotifyRefineFail(this, item, szRefineType, -1); ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (REFINE FAIL)"); pkNewItem->AddToCharacter(this, TItemPos(INVENTORY, bCell)); ITEM_MANAGER::instance().FlushDelayedSave(pkNewItem); pkNewItem->AttrLog(); //PointChange(POINT_GOLD, -prt->cost); PayRefineFee(prt->cost); } else { sys_err("cannot create item %u", result_fail_vnum); NotifyRefineFail(this, item, szRefineType); } } else { NotifyRefineFail(this, item, szRefineType); PayRefineFee(prt->cost); } return true; } #ifdef ENABLE_SPECIAL_STORAGE bool CHARACTER::RefineInformation(BYTE bCell, BYTE bType, TItemPos srcScroll) #else bool CHARACTER::RefineInformation(BYTE bCell, BYTE bType, int iAdditionalCell) #endif { if (bCell > INVENTORY_MAX_NUM) return false; LPITEM item = GetInventoryItem(bCell); if (!item) return false; // REFINE_COST if (bType == REFINE_TYPE_MONEY_ONLY && !GetQuestFlag("deviltower_zone.can_refine")) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç±Í Ÿ¿ö ¿Ï·á º¸»óÀº Çѹø±îÁö »ç¿ë°¡´ÉÇÕ´Ï´Ù.")); return false; } // END_OF_REFINE_COST TPacketGCRefineInformation p; p.header = HEADER_GC_REFINE_INFORMATION; p.pos = bCell; p.src_vnum = item->GetVnum(); p.result_vnum = item->GetRefinedVnum(); p.type = bType; if (p.result_vnum == 0) { sys_err("RefineInformation p.result_vnum == 0"); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (item->GetType() == ITEM_USE && item->GetSubType() == USE_TUNING) { if (bType == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº ÀÌ ¹æ½ÄÀ¸·Î´Â °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } else { #ifdef ENABLE_SPECIAL_STORAGE LPITEM itemScroll = GetItem(srcScroll); #else LPITEM itemScroll = GetInventoryItem(iAdditionalCell); #endif if (!itemScroll || item->GetVnum() == itemScroll->GetVnum()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°°Àº °³·®¼­¸¦ ÇÕÄ¥ ¼ö´Â ¾ø½À´Ï´Ù.")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÃູÀÇ ¼­¿Í ÇööÀ» ÇÕÄ¥ ¼ö ÀÖ½À´Ï´Ù.")); return false; } } } CRefineManager & rm = CRefineManager::instance(); const TRefineTable* prt = rm.GetRefineRecipe(item->GetRefineSet()); if (!prt) { sys_err("RefineInformation NOT GET REFINE SET %d", item->GetRefineSet()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } // REFINE_COST //MAIN_QUEST_LV7 if (GetQuestFlag("main_quest_lv7.refine_chance") > 0) { if (!item->CheckItemUseLevel(20) || item->GetType() != ITEM_WEAPON) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹«·á °³·® ±âȸ´Â 20 ÀÌÇÏÀÇ ¹«±â¸¸ °¡´ÉÇÕ´Ï´Ù")); return false; } p.cost = 0; } else p.cost = ComputeRefineFee(prt->cost); //END_MAIN_QUEST_LV7 p.prob = prt->prob; if (bType == REFINE_TYPE_MONEY_ONLY) { p.material_count = 0; memset(p.materials, 0, sizeof(p.materials)); } else { p.material_count = prt->material_count; thecore_memcpy(&p.materials, prt->materials, sizeof(prt->materials)); } // END_OF_REFINE_COST GetDesc()->Packet(&p, sizeof(TPacketGCRefineInformation)); #ifdef ENABLE_SPECIAL_STORAGE SetRefineMode(srcScroll); #else SetRefineMode(iAdditionalCell); #endif return true; } bool CHARACTER::RefineItem(LPITEM pkItem, LPITEM pkTarget) { if (!CanHandleItem()) return false; if (pkItem->GetSubType() == USE_TUNING) { // MUSIN_SCROLL if (pkItem->GetValue(0) == MUSIN_SCROLL) #ifdef ENABLE_SPECIAL_STORAGE RefineInformation(pkTarget->GetCell(), REFINE_TYPE_MUSIN, TItemPos(pkItem->GetWindow(), pkItem->GetCell())); #else RefineInformation(pkTarget->GetCell(), REFINE_TYPE_MUSIN, pkItem->GetCell()); #endif // END_OF_MUSIN_SCROLL else if (pkItem->GetValue(0) == HYUNIRON_CHN) #ifdef ENABLE_SPECIAL_STORAGE RefineInformation(pkTarget->GetCell(), REFINE_TYPE_HYUNIRON, TItemPos(pkItem->GetWindow(), pkItem->GetCell())); #else RefineInformation(pkTarget->GetCell(), REFINE_TYPE_HYUNIRON, pkItem->GetCell()); #endif else if (pkItem->GetValue(0) == BDRAGON_SCROLL) { if (pkTarget->GetRefineSet() != 702) return false; #ifdef ENABLE_SPECIAL_STORAGE RefineInformation(pkTarget->GetCell(), REFINE_TYPE_BDRAGON, TItemPos(pkItem->GetWindow(), pkItem->GetCell())); #else RefineInformation(pkTarget->GetCell(), REFINE_TYPE_BDRAGON, pkItem->GetCell()); #endif } else { if (pkTarget->GetRefineSet() == 501) return false; #ifdef ENABLE_SPECIAL_STORAGE RefineInformation(pkTarget->GetCell(), REFINE_TYPE_SCROLL, TItemPos(pkItem->GetWindow(), pkItem->GetCell())); #else RefineInformation(pkTarget->GetCell(), REFINE_TYPE_SCROLL, pkItem->GetCell()); #endif } } else if (pkItem->GetSubType() == USE_DETACHMENT && IS_SET(pkTarget->GetFlag(), ITEM_FLAG_REFINEABLE)) { LogManager::instance().ItemLog(this, pkTarget, "USE_DETACHMENT", pkTarget->GetName()); bool bHasMetinStone = false; for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++) { long socket = pkTarget->GetSocket(i); if (socket > 2 && socket != ITEM_BROKEN_METIN_VNUM) { bHasMetinStone = true; break; } } if (bHasMetinStone) { for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { long socket = pkTarget->GetSocket(i); if (socket > 2 && socket != ITEM_BROKEN_METIN_VNUM) { AutoGiveItem(socket); //TItemTable* pTable = ITEM_MANAGER::instance().GetTable(pkTarget->GetSocket(i)); //pkTarget->SetSocket(i, pTable->alValues[2]); pkTarget->SetSocket(i, ITEM_BROKEN_METIN_VNUM); } } pkItem->SetCount(pkItem->GetCount() - 1); return true; } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»©³¾ ¼ö ÀÖ´Â ¸ŞÆ¾¼®ÀÌ ¾ø½À´Ï´Ù.")); return false; } } return false; } EVENTFUNC(kill_campfire_event) { char_event_info* info = dynamic_cast<char_event_info*>( event->info ); if ( info == NULL ) { sys_err( "kill_campfire_event> <Factor> Null pointer" ); return 0; } LPCHARACTER ch = info->ch; if (ch == NULL) { // <Factor> return 0; } ch->m_pkMiningEvent = NULL; M2_DESTROY_CHARACTER(ch); return 0; } bool CHARACTER::GiveRecallItem(LPITEM item) { int idx = GetMapIndex(); int iEmpireByMapIndex = -1; if (idx < 20) iEmpireByMapIndex = 1; else if (idx < 40) iEmpireByMapIndex = 2; else if (idx < 60) iEmpireByMapIndex = 3; else if (idx < 10000) iEmpireByMapIndex = 0; switch (idx) { case 66: case 216: iEmpireByMapIndex = -1; break; } if (iEmpireByMapIndex && GetEmpire() != iEmpireByMapIndex) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±â¾ïÇØ µÑ ¼ö ¾ø´Â À§Ä¡ ÀÔ´Ï´Ù.")); return false; } int pos; if (item->GetCount() == 1) { item->SetSocket(0, GetX()); item->SetSocket(1, GetY()); } else if ((pos = GetEmptyInventory(item->GetSize())) != -1) { LPITEM item2 = ITEM_MANAGER::instance().CreateItem(item->GetVnum(), 1); if (NULL != item2) { item2->SetSocket(0, GetX()); item2->SetSocket(1, GetY()); item2->AddToCharacter(this, TItemPos(INVENTORY, pos)); item->SetCount(item->GetCount() - 1); } } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇ°¿¡ ºó °ø°£ÀÌ ¾ø½À´Ï´Ù.")); return false; } return true; } void CHARACTER::ProcessRecallItem(LPITEM item) { int idx; if ((idx = SECTREE_MANAGER::instance().GetMapIndex(item->GetSocket(0), item->GetSocket(1))) == 0) return; int iEmpireByMapIndex = -1; if (idx < 20) iEmpireByMapIndex = 1; else if (idx < 40) iEmpireByMapIndex = 2; else if (idx < 60) iEmpireByMapIndex = 3; else if (idx < 10000) iEmpireByMapIndex = 0; switch (idx) { case 66: case 216: iEmpireByMapIndex = -1; break; case 301: case 302: case 303: case 304: if( GetLevel() < 90 ) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛÀÇ ·¹º§ Á¦ÇѺ¸´Ù ·¹º§ÀÌ ³·½À´Ï´Ù.")); return; } else break; } if (iEmpireByMapIndex && GetEmpire() != iEmpireByMapIndex) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±â¾ïµÈ À§Ä¡°¡ ŸÁ¦±¹¿¡ ¼ÓÇØ À־ ±ÍȯÇÒ ¼ö ¾ø½À´Ï´Ù.")); item->SetSocket(0, 0); item->SetSocket(1, 0); } else { sys_log(1, "Recall: %s %d %d -> %d %d", GetName(), GetX(), GetY(), item->GetSocket(0), item->GetSocket(1)); WarpSet(item->GetSocket(0), item->GetSocket(1)); item->SetCount(item->GetCount() - 1); } } void CHARACTER::__OpenPrivateShop() { #ifdef ENABLE_OPEN_SHOP_WITH_ARMOR ChatPacket(CHAT_TYPE_COMMAND, "OpenPrivateShop"); #else unsigned bodyPart = GetPart(PART_MAIN); switch (bodyPart) { case 0: case 1: case 2: ChatPacket(CHAT_TYPE_COMMAND, "OpenPrivateShop"); break; default: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°©¿ÊÀ» ¹ş¾î¾ß °³ÀÎ »óÁ¡À» ¿­ ¼ö ÀÖ½À´Ï´Ù.")); break; } #endif } // MYSHOP_PRICE_LIST void CHARACTER::SendMyShopPriceListCmd(DWORD dwItemVnum, DWORD dwItemPrice) { char szLine[256]; snprintf(szLine, sizeof(szLine), "MyShopPriceList %u %u", dwItemVnum, dwItemPrice); ChatPacket(CHAT_TYPE_COMMAND, szLine); sys_log(0, szLine); } // // void CHARACTER::UseSilkBotaryReal(const TPacketMyshopPricelistHeader* p) { const TItemPriceInfo* pInfo = (const TItemPriceInfo*)(p + 1); if (!p->byCount) SendMyShopPriceListCmd(1, 0); else { for (int idx = 0; idx < p->byCount; idx++) SendMyShopPriceListCmd(pInfo[ idx ].dwVnum, pInfo[ idx ].dwPrice); } __OpenPrivateShop(); } // // void CHARACTER::UseSilkBotary(void) { if (m_bNoOpenedShop) { DWORD dwPlayerID = GetPlayerID(); db_clientdesc->DBPacket(HEADER_GD_MYSHOP_PRICELIST_REQ, GetDesc()->GetHandle(), &dwPlayerID, sizeof(DWORD)); m_bNoOpenedShop = false; } else { __OpenPrivateShop(); } } // END_OF_MYSHOP_PRICE_LIST int CalculateConsume(LPCHARACTER ch) { static const int WARP_NEED_LIFE_PERCENT = 30; static const int WARP_MIN_LIFE_PERCENT = 10; // CONSUME_LIFE_WHEN_USE_WARP_ITEM int consumeLife = 0; { // CheckNeedLifeForWarp const int curLife = ch->GetHP(); const int needPercent = WARP_NEED_LIFE_PERCENT; const int needLife = ch->GetMaxHP() * needPercent / 100; if (curLife < needLife) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³²Àº »ı¸í·Â ¾çÀÌ ¸ğÀÚ¶ó »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return -1; } consumeLife = needLife; const int minPercent = WARP_MIN_LIFE_PERCENT; const int minLife = ch->GetMaxHP() * minPercent / 100; if (curLife - needLife < minLife) consumeLife = curLife - minLife; if (consumeLife < 0) consumeLife = 0; } // END_OF_CONSUME_LIFE_WHEN_USE_WARP_ITEM return consumeLife; } int CalculateConsumeSP(LPCHARACTER lpChar) { static const int NEED_WARP_SP_PERCENT = 30; const int curSP = lpChar->GetSP(); const int needSP = lpChar->GetMaxSP() * NEED_WARP_SP_PERCENT / 100; if (curSP < needSP) { lpChar->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³²Àº Á¤½Å·Â ¾çÀÌ ¸ğÀÚ¶ó »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return -1; } return needSP; } // #define ENABLE_FIREWORK_STUN #define ENABLE_ADDSTONE_FAILURE bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) { int iLimitRealtimeStartFirstUseFlagIndex = -1; //int iLimitTimerBasedOnWearFlagIndex = -1; WORD wDestCell = DestCell.cell; BYTE bDestInven = DestCell.window_type; for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) { long limitValue = item->GetProto()->aLimits[i].lValue; switch (item->GetProto()->aLimits[i].bType) { case LIMIT_LEVEL: if (GetLevel() < limitValue) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛÀÇ ·¹º§ Á¦ÇѺ¸´Ù ·¹º§ÀÌ ³·½À´Ï´Ù.")); return false; } break; case LIMIT_REAL_TIME_START_FIRST_USE: iLimitRealtimeStartFirstUseFlagIndex = i; break; case LIMIT_TIMER_BASED_ON_WEAR: //iLimitTimerBasedOnWearFlagIndex = i; break; } } if (test_server) { sys_log(0, "USE_ITEM %s, Inven %d, Cell %d, ItemType %d, SubType %d", item->GetName(), bDestInven, wDestCell, item->GetType(), item->GetSubType()); } if ( CArenaManager::instance().IsLimitedItem( GetMapIndex(), item->GetVnum() ) == true ) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && IsLimitedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif // @fixme402 (IsLoadedAffect to block affect hacking) if (!IsLoadedAffect()) { ChatPacket(CHAT_TYPE_INFO, "Affects are not loaded yet!"); return false; } // @fixme141 BEGIN if (TItemPos(item->GetWindow(), item->GetCell()).IsBeltInventoryPosition()) { LPITEM beltItem = GetWear(WEAR_BELT); if (NULL == beltItem) { ChatPacket(CHAT_TYPE_INFO, "<Belt> You can't use this item if you have no equipped belt."); return false; } if (false == CBeltInventoryHelper::IsAvailableCell(item->GetCell() - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0))) { ChatPacket(CHAT_TYPE_INFO, "<Belt> You can't use this item if you don't upgrade your belt."); return false; } } // @fixme141 END if (-1 != iLimitRealtimeStartFirstUseFlagIndex) { if (0 == item->GetSocket(1)) { long duration = (0 != item->GetSocket(0)) ? item->GetSocket(0) : item->GetProto()->aLimits[iLimitRealtimeStartFirstUseFlagIndex].lValue; if (0 == duration) duration = 60 * 60 * 24 * 7; item->SetSocket(0, time(0) + duration); item->StartRealTimeExpireEvent(); } if (false == item->IsEquipped()) item->SetSocket(1, item->GetSocket(1) + 1); } #ifdef NEW_PET_SYSTEM if (item->GetVnum() == 55001) { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsExchanging()) return false; if (item2->GetVnum() > 55704 || item2->GetVnum() < 55701) return false; char szQuery1[1024]; snprintf(szQuery1, sizeof(szQuery1), "SELECT duration FROM new_petsystem WHERE id = %d LIMIT 1", item2->GetID()); std::auto_ptr<SQLMsg> pmsg2(DBManager::instance().DirectQuery(szQuery1)); if (pmsg2->Get()->uiNumRows > 0) { MYSQL_ROW row = mysql_fetch_row(pmsg2->Get()->pSQLResult); if (atoi(row[0]) > 0) { if (GetNewPetSystem()->IsActivePet()) { ChatPacket(CHAT_TYPE_INFO, "Aktif olan petini kapatmalisin! "); return false; } std::auto_ptr<SQLMsg> pmsg3(DBManager::instance().DirectQuery("UPDATE new_petsystem SET duration =(tduration) WHERE id = %d", item2->GetID())); ChatPacket(CHAT_TYPE_INFO, "Suan petinin yasam zamani fullendi! "); } else { std::auto_ptr<SQLMsg> pmsg4(DBManager::instance().DirectQuery("UPDATE new_petsystem SET duration =(tduration/2) WHERE id = %d", item2->GetID())); ChatPacket(CHAT_TYPE_INFO, "Suan petinin hayat zamani duzeltildi! "); } item->SetCount(item->GetCount() - 1); return true; } else return false; } if (item->GetVnum() >= 55701 && item->GetVnum() <= 55704) { LPITEM item2; if (item2 = GetItem(DestCell)) { if (item2->GetVnum() == 55002) { if(item2->GetAttributeValue(0) > 0) { //ChatPacket(CHAT_TYPE_INFO, ""); } else { if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsExchanging()) return false; if (GetNewPetSystem()->IsActivePet()) { ChatPacket(CHAT_TYPE_INFO, "Aktif olan petini kapatmalisin! "); return false; } for (int b = 0; b < 3; b++) { item2->SetForceAttribute(b, 1, item->GetAttributeValue(b)); } item2->SetForceAttribute(3, 1, item->GetAttributeValue(3)); item2->SetForceAttribute(4, 1, item->GetAttributeValue(4)); item2->SetForceAttribute(5, 1, item->GetAttributeValue(5)); DWORD vnum1 = item->GetVnum()-55700; item2->SetSocket(0, vnum1); item2->SetSocket(1, item->GetSocket(1)); std::auto_ptr<SQLMsg> pmsg5(DBManager::instance().DirectQuery("UPDATE new_petsystem SET id =%d WHERE id = %d", item2->GetID(), item->GetID())); ITEM_MANAGER::instance().RemoveItem(item); return true; } } } } if (item->GetVnum() == 55002 && item->GetAttributeValue(0) > 0) { int pos = GetEmptyInventory(item->GetSize()); if(pos == -1) { ChatPacket(CHAT_TYPE_INFO, "Envanterinde bos yer yok!"); return false; } if (item->IsExchanging()) return false; DWORD vnum2 = 55700+item->GetSocket(0); LPITEM item2 = AutoGiveItem(vnum2, 1); for (int b = 0; b < 3; b++) { item2->SetForceAttribute(b, 1, item->GetAttributeValue(b)); } item2->SetForceAttribute(3, 1, item->GetAttributeValue(3)); item2->SetForceAttribute(4, 1, item->GetAttributeValue(4)); item2->SetForceAttribute(5, 1, item->GetAttributeValue(5)); item2->SetSocket(1,item->GetSocket(1)); std::auto_ptr<SQLMsg> pmsg6(DBManager::instance().DirectQuery("UPDATE new_petsystem SET id =%d WHERE id = %d", item2->GetID(), item->GetID())); ITEM_MANAGER::instance().RemoveItem(item); return true; } #endif switch (item->GetType()) { case ITEM_HAIR: return ItemProcess_Hair(item, wDestCell); case ITEM_POLYMORPH: return ItemProcess_Polymorph(item); case ITEM_QUEST: if (GetArena() != NULL || IsObserverMode() == true) { if (item->GetVnum() == 50051 || item->GetVnum() == 50052 || item->GetVnum() == 50053) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } } if (!IS_SET(item->GetFlag(), ITEM_FLAG_QUEST_USE | ITEM_FLAG_QUEST_USE_MULTIPLE)) { if (item->GetSIGVnum() == 0) { quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false); } else { quest::CQuestManager::instance().SIGUse(GetPlayerID(), item->GetSIGVnum(), item, false); } } break; case ITEM_CAMPFIRE: { float fx, fy; GetDeltaByDegree(GetRotation(), 100.0f, &fx, &fy); LPSECTREE tree = SECTREE_MANAGER::instance().Get(GetMapIndex(), (long)(GetX()+fx), (long)(GetY()+fy)); if (!tree) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸ğ´ÚºÒÀ» ÇÇ¿ï ¼ö ¾ø´Â ÁöÁ¡ÀÔ´Ï´Ù.")); return false; } if (tree->IsAttr((long)(GetX()+fx), (long)(GetY()+fy), ATTR_WATER)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹° ¼Ó¿¡ ¸ğ´ÚºÒÀ» ÇÇ¿ï ¼ö ¾ø½À´Ï´Ù.")); return false; } if (get_global_time() - GetQuestFlag("kamp.ates") < 60) { ChatPacket(CHAT_TYPE_INFO, "<Sistem> Bunu yapabilmek icin 60 saniye beklemelisin!"); return false; } SetQuestFlag("kamp.ates", get_global_time()); LPCHARACTER campfire = CHARACTER_MANAGER::instance().SpawnMob(fishing::CAMPFIRE_MOB, GetMapIndex(), (long)(GetX()+fx), (long)(GetY()+fy), 0, false, number(0, 359)); char_event_info* info = AllocEventInfo<char_event_info>(); info->ch = campfire; campfire->m_pkMiningEvent = event_create(kill_campfire_event, info, PASSES_PER_SEC(40)); item->SetCount(item->GetCount() - 1); } break; case ITEM_UNIQUE: { switch (item->GetSubType()) { case USE_ABILITY_UP: { switch (item->GetValue(0)) { case APPLY_MOV_SPEED: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_MOV_SPEED, item->GetValue(2), AFF_MOV_SPEED_POTION, item->GetValue(1), 0, true, true); break; case APPLY_ATT_SPEED: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_ATT_SPEED, item->GetValue(2), AFF_ATT_SPEED_POTION, item->GetValue(1), 0, true, true); break; case APPLY_STR: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_ST, item->GetValue(2), 0, item->GetValue(1), 0, true, true); break; case APPLY_DEX: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_DX, item->GetValue(2), 0, item->GetValue(1), 0, true, true); break; case APPLY_CON: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_HT, item->GetValue(2), 0, item->GetValue(1), 0, true, true); break; case APPLY_INT: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_IQ, item->GetValue(2), 0, item->GetValue(1), 0, true, true); break; case APPLY_CAST_SPEED: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_CASTING_SPEED, item->GetValue(2), 0, item->GetValue(1), 0, true, true); break; case APPLY_RESIST_MAGIC: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_RESIST_MAGIC, item->GetValue(2), 0, item->GetValue(1), 0, true, true); break; case APPLY_ATT_GRADE_BONUS: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_ATT_GRADE_BONUS, item->GetValue(2), 0, item->GetValue(1), 0, true, true); break; case APPLY_DEF_GRADE_BONUS: AddAffect(AFFECT_UNIQUE_ABILITY, POINT_DEF_GRADE_BONUS, item->GetValue(2), 0, item->GetValue(1), 0, true, true); break; } } if (GetDungeon()) GetDungeon()->UsePotion(this); if (GetWarMap()) GetWarMap()->UsePotion(this, item); item->SetCount(item->GetCount() - 1); break; default: { if (item->GetSubType() == USE_SPECIAL) { sys_log(0, "ITEM_UNIQUE: USE_SPECIAL %u", item->GetVnum()); switch (item->GetVnum()) { case 71049: if (g_bEnableBootaryCheck) { if (IS_BOTARYABLE_ZONE(GetMapIndex()) == true) { UseSilkBotary(); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³ÀÎ »óÁ¡À» ¿­ ¼ö ¾ø´Â Áö¿ªÀÔ´Ï´Ù")); } } else { UseSilkBotary(); } break; } } else { if (!item->IsEquipped()) EquipItem(item); else UnequipItem(item); } } break; } } break; case ITEM_COSTUME: case ITEM_WEAPON: case ITEM_ARMOR: case ITEM_ROD: case ITEM_RING: case ITEM_BELT: // MINING case ITEM_PICK: // END_OF_MINING if (!item->IsEquipped()) EquipItem(item); else UnequipItem(item); break; case ITEM_DS: { if (!item->IsEquipped()) return false; return DSManager::instance().PullOut(this, NPOS, item); break; } case ITEM_SPECIAL_DS: if (!item->IsEquipped()) EquipItem(item); else UnequipItem(item); break; case ITEM_FISH: { if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif if (item->GetSubType() == FISH_ALIVE) fishing::UseFish(this, item); } break; case ITEM_TREASURE_BOX: { return false; } break; case ITEM_TREASURE_KEY: { LPITEM item2; if (!GetItem(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114 return false; if (item2->GetType() != ITEM_TREASURE_BOX) { ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("¿­¼è·Î ¿©´Â ¹°°ÇÀÌ ¾Æ´Ñ°Í °°´Ù.")); return false; } if (item->GetValue(0) == item2->GetValue(0)) { DWORD dwBoxVnum = item2->GetVnum(); std::vector <DWORD> dwVnums; std::vector <DWORD> dwCounts; std::vector <LPITEM> item_gets(0); int count = 0; if (GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count)) { ITEM_MANAGER::instance().RemoveItem(item); ITEM_MANAGER::instance().RemoveItem(item2); for (int i = 0; i < count; i++){ switch (dwVnums[i]) { case CSpecialItemGroup::GOLD: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µ· %d ³ÉÀ» ȹµæÇß½À´Ï´Ù."), dwCounts[i]); break; case CSpecialItemGroup::EXP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ºÎÅÍ ½ÅºñÇÑ ºûÀÌ ³ª¿É´Ï´Ù.")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%dÀÇ °æÇèÄ¡¸¦ ȹµæÇß½À´Ï´Ù."), dwCounts[i]); break; case CSpecialItemGroup::MOB: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ¸ó½ºÅÍ°¡ ³ªÅ¸³µ½À´Ï´Ù!")); break; case CSpecialItemGroup::SLOW: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â »¡°£ ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ ¿òÁ÷ÀÌ´Â ¼Óµµ°¡ ´À·ÁÁ³½À´Ï´Ù!")); break; case CSpecialItemGroup::DRAIN_HP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ°¡ °©ÀÚ±â Æø¹ßÇÏ¿´½À´Ï´Ù! »ı¸í·ÂÀÌ °¨¼ÒÇß½À´Ï´Ù.")); break; case CSpecialItemGroup::POISON: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â ³ì»ö ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ µ¶ÀÌ ¿Â¸öÀ¸·Î ÆÛÁı´Ï´Ù!")); break; #ifdef ENABLE_WOLFMAN_CHARACTER case CSpecialItemGroup::BLEEDING: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â ³ì»ö ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ µ¶ÀÌ ¿Â¸öÀ¸·Î ÆÛÁı´Ï´Ù!")); break; #endif case CSpecialItemGroup::MOB_GROUP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ¸ó½ºÅÍ°¡ ³ªÅ¸³µ½À´Ï´Ù!")); break; default: if (item_gets[i]) { if (dwCounts[i] > 1) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ %s °¡ %d °³ ³ª¿Ô½À´Ï´Ù."), item_gets[i]->GetName(), dwCounts[i]); else ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ %s °¡ ³ª¿Ô½À´Ï´Ù."), item_gets[i]->GetName()); } } } } else { ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("¿­¼è°¡ ¸ÂÁö ¾Ê´Â °Í °°´Ù.")); return false; } } else { ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("¿­¼è°¡ ¸ÂÁö ¾Ê´Â °Í °°´Ù.")); return false; } } break; case ITEM_GIFTBOX: { #ifdef ENABLE_NEWSTUFF if (0 != g_BoxUseTimeLimitValue) { if (get_dword_time() < m_dwLastBoxUseTime+g_BoxUseTimeLimitValue) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ °ñµå¸¦ ¹ö¸± ¼ö ¾ø½À´Ï´Ù.")); return false; } } m_dwLastBoxUseTime = get_dword_time(); #endif DWORD dwBoxVnum = item->GetVnum(); std::vector <DWORD> dwVnums; std::vector <DWORD> dwCounts; std::vector <LPITEM> item_gets(0); int count = 0; if( dwBoxVnum > 51500 && dwBoxVnum < 52000 ) { if( !(this->DragonSoul_IsQualified()) ) { ChatPacket(CHAT_TYPE_INFO,LC_TEXT("¸ÕÀú ¿ëÈ¥¼® Äù½ºÆ®¸¦ ¿Ï·áÇÏ¼Å¾ß ÇÕ´Ï´Ù.")); return false; } } if (GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count)) { item->SetCount(item->GetCount()-1); for (int i = 0; i < count; i++){ switch (dwVnums[i]) { case CSpecialItemGroup::GOLD: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µ· %d ³ÉÀ» ȹµæÇß½À´Ï´Ù."), dwCounts[i]); break; case CSpecialItemGroup::EXP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ºÎÅÍ ½ÅºñÇÑ ºûÀÌ ³ª¿É´Ï´Ù.")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%dÀÇ °æÇèÄ¡¸¦ ȹµæÇß½À´Ï´Ù."), dwCounts[i]); break; case CSpecialItemGroup::MOB: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ¸ó½ºÅÍ°¡ ³ªÅ¸³µ½À´Ï´Ù!")); break; case CSpecialItemGroup::SLOW: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â »¡°£ ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ ¿òÁ÷ÀÌ´Â ¼Óµµ°¡ ´À·ÁÁ³½À´Ï´Ù!")); break; case CSpecialItemGroup::DRAIN_HP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ°¡ °©ÀÚ±â Æø¹ßÇÏ¿´½À´Ï´Ù! »ı¸í·ÂÀÌ °¨¼ÒÇß½À´Ï´Ù.")); break; case CSpecialItemGroup::POISON: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â ³ì»ö ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ µ¶ÀÌ ¿Â¸öÀ¸·Î ÆÛÁı´Ï´Ù!")); break; #ifdef ENABLE_WOLFMAN_CHARACTER case CSpecialItemGroup::BLEEDING: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â ³ì»ö ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ µ¶ÀÌ ¿Â¸öÀ¸·Î ÆÛÁı´Ï´Ù!")); break; #endif case CSpecialItemGroup::MOB_GROUP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ¸ó½ºÅÍ°¡ ³ªÅ¸³µ½À´Ï´Ù!")); break; default: if (item_gets[i]) { if (dwCounts[i] > 1) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ %s °¡ %d °³ ³ª¿Ô½À´Ï´Ù."), item_gets[i]->GetName(), dwCounts[i]); else ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ %s °¡ ³ª¿Ô½À´Ï´Ù."), item_gets[i]->GetName()); } } } } else { ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("¾Æ¹«°Íµµ ¾òÀ» ¼ö ¾ø¾ú½À´Ï´Ù.")); return false; } } break; case ITEM_SKILLFORGET: { if (!item->GetSocket(0)) { ITEM_MANAGER::instance().RemoveItem(item); return false; } DWORD dwVnum = item->GetSocket(0); if (SkillLevelDown(dwVnum)) { ITEM_MANAGER::instance().RemoveItem(item); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("½ºÅ³ ·¹º§À» ³»¸®´Âµ¥ ¼º°øÇÏ¿´½À´Ï´Ù.")); } else ChatPacket(CHAT_TYPE_INFO, LC_TEXT("½ºÅ³ ·¹º§À» ³»¸± ¼ö ¾ø½À´Ï´Ù.")); } break; case ITEM_SKILLBOOK: { if (IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯½ÅÁß¿¡´Â Ã¥À» ÀĞÀ»¼ö ¾ø½À´Ï´Ù.")); return false; } DWORD dwVnum = 0; if (item->GetVnum() == 50300) { dwVnum = item->GetSocket(0); } else { dwVnum = item->GetValue(0); } if (0 == dwVnum) { ITEM_MANAGER::instance().RemoveItem(item); return false; } if (true == LearnSkillByBook(dwVnum)) { #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; SetSkillNextReadTime(dwVnum, get_global_time() + iReadDelay); } } break; case ITEM_USE: { if (item->GetVnum() > 50800 && item->GetVnum() <= 50820) { if (test_server) sys_log (0, "ADD addtional effect : vnum(%d) subtype(%d)", item->GetOriginalVnum(), item->GetSubType()); int affect_type = AFFECT_EXP_BONUS_EURO_FREE; int apply_type = aApplyInfo[item->GetValue(0)].bPointType; int apply_value = item->GetValue(2); int apply_duration = item->GetValue(1); switch (item->GetSubType()) { case USE_ABILITY_UP: if (FindAffect(affect_type, apply_type)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù.")); return false; } { switch (item->GetValue(0)) { case APPLY_MOV_SPEED: AddAffect(affect_type, apply_type, apply_value, AFF_MOV_SPEED_POTION, apply_duration, 0, true, true); break; case APPLY_ATT_SPEED: AddAffect(affect_type, apply_type, apply_value, AFF_ATT_SPEED_POTION, apply_duration, 0, true, true); break; case APPLY_STR: case APPLY_DEX: case APPLY_CON: case APPLY_INT: case APPLY_CAST_SPEED: case APPLY_RESIST_MAGIC: case APPLY_ATT_GRADE_BONUS: case APPLY_DEF_GRADE_BONUS: AddAffect(affect_type, apply_type, apply_value, 0, apply_duration, 0, true, true); break; } } if (GetDungeon()) GetDungeon()->UsePotion(this); if (GetWarMap()) GetWarMap()->UsePotion(this, item); item->SetCount(item->GetCount() - 1); break; case USE_AFFECT : { if (FindAffect(AFFECT_EXP_BONUS_EURO_FREE, aApplyInfo[item->GetValue(1)].bPointType)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù.")); } else { // PC_BANG_ITEM_ADD if (item->IsPCBangItem() == true) { if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº PC¹æ¿¡¼­¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); return false; } } // END_PC_BANG_ITEM_ADD AddAffect(AFFECT_EXP_BONUS_EURO_FREE, aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false, true); item->SetCount(item->GetCount() - 1); } } break; case USE_POTION_NODELAY: { if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { if (quest::CQuestManager::instance().GetEventFlag("arena_potion_limit") > 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.")); return false; } switch (item->GetVnum()) { case 70020 : case 71018 : case 71019 : case 71020 : if (quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count") < 10000) { if (m_nPotionLimit <= 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç¿ë Á¦ÇÑ·®À» ÃÊ°úÇÏ¿´½À´Ï´Ù.")); return false; } } break; default : ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.")); return false; break; } } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif bool used = false; if (item->GetValue(0) != 0) { if (GetHP() < GetMaxHP()) { PointChange(POINT_HP, item->GetValue(0) * (100 + GetPoint(POINT_POTION_BONUS)) / 100); EffectPacket(SE_HPUP_RED); used = TRUE; } } if (item->GetValue(1) != 0) { if (GetSP() < GetMaxSP()) { PointChange(POINT_SP, item->GetValue(1) * (100 + GetPoint(POINT_POTION_BONUS)) / 100); EffectPacket(SE_SPUP_BLUE); used = TRUE; } } if (item->GetValue(3) != 0) { if (GetHP() < GetMaxHP()) { PointChange(POINT_HP, item->GetValue(3) * GetMaxHP() / 100); EffectPacket(SE_HPUP_RED); used = TRUE; } } if (item->GetValue(4) != 0) { if (GetSP() < GetMaxSP()) { PointChange(POINT_SP, item->GetValue(4) * GetMaxSP() / 100); EffectPacket(SE_SPUP_BLUE); used = TRUE; } } if (used) { if (item->GetVnum() == 50085 || item->GetVnum() == 50086) { if (test_server) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ùº´ ¶Ç´Â Á¾ÀÚ ¸¦ »ç¿ëÇÏ¿´½À´Ï´Ù")); SetUseSeedOrMoonBottleTime(); } if (GetDungeon()) GetDungeon()->UsePotion(this); if (GetWarMap()) GetWarMap()->UsePotion(this, item); m_nPotionLimit--; //RESTRICT_USE_SEED_OR_MOONBOTTLE item->SetCount(item->GetCount() - 1); //END_RESTRICT_USE_SEED_OR_MOONBOTTLE } } break; } return true; } if (item->GetVnum() >= 27863 && item->GetVnum() <= 27883) { if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif } if (test_server) { sys_log (0, "USE_ITEM %s Type %d SubType %d vnum %d", item->GetName(), item->GetType(), item->GetSubType(), item->GetOriginalVnum()); } switch (item->GetSubType()) { case USE_TIME_CHARGE_PER: { LPITEM pDestItem = GetItem(DestCell); if (NULL == pDestItem) { return false; } if (pDestItem->IsDragonSoul()) { int ret; char buf[128]; if (item->GetVnum() == DRAGON_HEART_VNUM) { ret = pDestItem->GiveMoreTime_Per((float)item->GetSocket(ITEM_SOCKET_CHARGING_AMOUNT_IDX)); } else { ret = pDestItem->GiveMoreTime_Per((float)item->GetValue(ITEM_VALUE_CHARGING_AMOUNT_IDX)); } if (ret > 0) { if (item->GetVnum() == DRAGON_HEART_VNUM) { sprintf(buf, "Inc %ds by item{VN:%d SOC%d:%ld}", ret, item->GetVnum(), ITEM_SOCKET_CHARGING_AMOUNT_IDX, item->GetSocket(ITEM_SOCKET_CHARGING_AMOUNT_IDX)); } else { sprintf(buf, "Inc %ds by item{VN:%d VAL%d:%ld}", ret, item->GetVnum(), ITEM_VALUE_CHARGING_AMOUNT_IDX, item->GetValue(ITEM_VALUE_CHARGING_AMOUNT_IDX)); } ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%dÃÊ ¸¸Å­ ÃæÀüµÇ¾ú½À´Ï´Ù."), ret); item->SetCount(item->GetCount() - 1); LogManager::instance().ItemLog(this, item, "DS_CHARGING_SUCCESS", buf); return true; } else { if (item->GetVnum() == DRAGON_HEART_VNUM) { sprintf(buf, "No change by item{VN:%d SOC%d:%ld}", item->GetVnum(), ITEM_SOCKET_CHARGING_AMOUNT_IDX, item->GetSocket(ITEM_SOCKET_CHARGING_AMOUNT_IDX)); } else { sprintf(buf, "No change by item{VN:%d VAL%d:%ld}", item->GetVnum(), ITEM_VALUE_CHARGING_AMOUNT_IDX, item->GetValue(ITEM_VALUE_CHARGING_AMOUNT_IDX)); } ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÃæÀüÇÒ ¼ö ¾ø½À´Ï´Ù.")); LogManager::instance().ItemLog(this, item, "DS_CHARGING_FAILED", buf); return false; } } else return false; } break; case USE_TIME_CHARGE_FIX: { LPITEM pDestItem = GetItem(DestCell); if (NULL == pDestItem) { return false; } if (pDestItem->IsDragonSoul()) { int ret = pDestItem->GiveMoreTime_Fix(item->GetValue(ITEM_VALUE_CHARGING_AMOUNT_IDX)); char buf[128]; if (ret) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%dÃÊ ¸¸Å­ ÃæÀüµÇ¾ú½À´Ï´Ù."), ret); sprintf(buf, "Increase %ds by item{VN:%d VAL%d:%ld}", ret, item->GetVnum(), ITEM_VALUE_CHARGING_AMOUNT_IDX, item->GetValue(ITEM_VALUE_CHARGING_AMOUNT_IDX)); LogManager::instance().ItemLog(this, item, "DS_CHARGING_SUCCESS", buf); item->SetCount(item->GetCount() - 1); return true; } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÃæÀüÇÒ ¼ö ¾ø½À´Ï´Ù.")); sprintf(buf, "No change by item{VN:%d VAL%d:%ld}", item->GetVnum(), ITEM_VALUE_CHARGING_AMOUNT_IDX, item->GetValue(ITEM_VALUE_CHARGING_AMOUNT_IDX)); LogManager::instance().ItemLog(this, item, "DS_CHARGING_FAILED", buf); return false; } } else return false; } break; case USE_SPECIAL: switch (item->GetVnum()) { case ITEM_NOG_POCKET: { /* ¶õÁÖ´É·ÂÄ¡ : item_proto value ÀÇ¹Ì À̵¿¼Óµµ value 1 °ø°İ·Â value 2 °æÇèÄ¡ value 3 Áö¼Ó½Ã°£ value 0 (´ÜÀ§ ÃÊ) */ if (FindAffect(AFFECT_NOG_ABILITY)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù.")); return false; } long time = item->GetValue(0); long moveSpeedPer = item->GetValue(1); long attPer = item->GetValue(2); long expPer = item->GetValue(3); AddAffect(AFFECT_NOG_ABILITY, POINT_MOV_SPEED, moveSpeedPer, AFF_MOV_SPEED_POTION, time, 0, true, true); AddAffect(AFFECT_NOG_ABILITY, POINT_MALL_ATTBONUS, attPer, AFF_NONE, time, 0, true, true); AddAffect(AFFECT_NOG_ABILITY, POINT_MALL_EXPBONUS, expPer, AFF_NONE, time, 0, true, true); item->SetCount(item->GetCount() - 1); } break; case ITEM_RAMADAN_CANDY: { /* »çÅÁ´É·ÂÄ¡ : item_proto value ÀÇ¹Ì À̵¿¼Óµµ value 1 °ø°İ·Â value 2 °æÇèÄ¡ value 3 Áö¼Ó½Ã°£ value 0 (´ÜÀ§ ÃÊ) */ // @fixme147 BEGIN if (FindAffect(AFFECT_RAMADAN_ABILITY)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù.")); return false; } // @fixme147 END long time = item->GetValue(0); long moveSpeedPer = item->GetValue(1); long attPer = item->GetValue(2); long expPer = item->GetValue(3); AddAffect(AFFECT_RAMADAN_ABILITY, POINT_MOV_SPEED, moveSpeedPer, AFF_MOV_SPEED_POTION, time, 0, true, true); AddAffect(AFFECT_RAMADAN_ABILITY, POINT_MALL_ATTBONUS, attPer, AFF_NONE, time, 0, true, true); AddAffect(AFFECT_RAMADAN_ABILITY, POINT_MALL_EXPBONUS, expPer, AFF_NONE, time, 0, true, true); item->SetCount(item->GetCount() - 1); } break; case ITEM_MARRIAGE_RING: { marriage::TMarriage* pMarriage = marriage::CManager::instance().Get(GetPlayerID()); if (pMarriage) { if (pMarriage->ch1 != NULL) { if (CArenaManager::instance().IsArenaMap(pMarriage->ch1->GetMapIndex()) == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); break; } } if (pMarriage->ch2 != NULL) { if (CArenaManager::instance().IsArenaMap(pMarriage->ch2->GetMapIndex()) == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); break; } } int consumeSP = CalculateConsumeSP(this); if (consumeSP < 0) return false; PointChange(POINT_SP, -consumeSP, false); WarpToPID(pMarriage->GetOther(GetPlayerID())); } else ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°áÈ¥ »óÅ°¡ ¾Æ´Ï¸é °áÈ¥¹İÁö¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); } break; case UNIQUE_ITEM_CAPE_OF_COURAGE: case 70057: case REWARD_BOX_UNIQUE_ITEM_CAPE_OF_COURAGE: AggregateMonster(); item->SetCount(item->GetCount()-1); break; case UNIQUE_ITEM_WHITE_FLAG: ForgetMyAttacker(); item->SetCount(item->GetCount()-1); break; case UNIQUE_ITEM_TREASURE_BOX: break; case 30093: case 30094: case 30095: case 30096: { const int MAX_BAG_INFO = 26; static struct LuckyBagInfo { DWORD count; int prob; DWORD vnum; } b1[MAX_BAG_INFO] = { { 1000, 302, 1 }, { 10, 150, 27002 }, { 10, 75, 27003 }, { 10, 100, 27005 }, { 10, 50, 27006 }, { 10, 80, 27001 }, { 10, 50, 27002 }, { 10, 80, 27004 }, { 10, 50, 27005 }, { 1, 10, 50300 }, { 1, 6, 92 }, { 1, 2, 132 }, { 1, 6, 1052 }, { 1, 2, 1092 }, { 1, 6, 2082 }, { 1, 2, 2122 }, { 1, 6, 3082 }, { 1, 2, 3122 }, { 1, 6, 5052 }, { 1, 2, 5082 }, { 1, 6, 7082 }, { 1, 2, 7122 }, { 1, 1, 11282 }, { 1, 1, 11482 }, { 1, 1, 11682 }, { 1, 1, 11882 }, }; LuckyBagInfo * bi = NULL; bi = b1; int pct = number(1, 1000); int i; for (i=0;i<MAX_BAG_INFO;i++) { if (pct <= bi[i].prob) break; pct -= bi[i].prob; } if (i>=MAX_BAG_INFO) return false; if (bi[i].vnum == 50300) { GiveRandomSkillBook(); } else if (bi[i].vnum == 1) { PointChange(POINT_GOLD, 1000, true); } else { AutoGiveItem(bi[i].vnum, bi[i].count); } ITEM_MANAGER::instance().RemoveItem(item); } break; case 50004: { if (item->GetSocket(0)) { item->SetSocket(0, item->GetSocket(0) + 1); } else { int iMapIndex = GetMapIndex(); PIXEL_POSITION pos; if (SECTREE_MANAGER::instance().GetRandomLocation(iMapIndex, pos, 700)) { item->SetSocket(0, 1); item->SetSocket(1, pos.x); item->SetSocket(2, pos.y); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ °÷¿¡¼± À̺¥Æ®¿ë °¨Áö±â°¡ µ¿ÀÛÇÏÁö ¾Ê´Â°Í °°½À´Ï´Ù.")); return false; } } int dist = 0; float distance = (DISTANCE_SQRT(GetX()-item->GetSocket(1), GetY()-item->GetSocket(2))); if (distance < 1000.0f) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À̺¥Æ®¿ë °¨Áö±â°¡ ½Åºñ·Î¿î ºûÀ» ³»¸ç »ç¶óÁı´Ï´Ù.")); struct TEventStoneInfo { DWORD dwVnum; int count; int prob; }; const int EVENT_STONE_MAX_INFO = 15; TEventStoneInfo info_10[EVENT_STONE_MAX_INFO] = { { 27001, 10, 8 }, { 27004, 10, 6 }, { 27002, 10, 12 }, { 27005, 10, 12 }, { 27100, 1, 9 }, { 27103, 1, 9 }, { 27101, 1, 10 }, { 27104, 1, 10 }, { 27999, 1, 12 }, { 25040, 1, 4 }, { 27410, 1, 0 }, { 27600, 1, 0 }, { 25100, 1, 0 }, { 50001, 1, 0 }, { 50003, 1, 1 }, }; TEventStoneInfo info_7[EVENT_STONE_MAX_INFO] = { { 27001, 10, 1 }, { 27004, 10, 1 }, { 27004, 10, 9 }, { 27005, 10, 9 }, { 27100, 1, 5 }, { 27103, 1, 5 }, { 27101, 1, 10 }, { 27104, 1, 10 }, { 27999, 1, 14 }, { 25040, 1, 5 }, { 27410, 1, 5 }, { 27600, 1, 5 }, { 25100, 1, 5 }, { 50001, 1, 0 }, { 50003, 1, 5 }, }; TEventStoneInfo info_4[EVENT_STONE_MAX_INFO] = { { 27001, 10, 0 }, { 27004, 10, 0 }, { 27002, 10, 0 }, { 27005, 10, 0 }, { 27100, 1, 0 }, { 27103, 1, 0 }, { 27101, 1, 0 }, { 27104, 1, 0 }, { 27999, 1, 25 }, { 25040, 1, 0 }, { 27410, 1, 0 }, { 27600, 1, 0 }, { 25100, 1, 15 }, { 50001, 1, 10 }, { 50003, 1, 50 }, }; { TEventStoneInfo* info; if (item->GetSocket(0) <= 4) info = info_4; else if (item->GetSocket(0) <= 7) info = info_7; else info = info_10; int prob = number(1, 100); for (int i = 0; i < EVENT_STONE_MAX_INFO; ++i) { if (!info[i].prob) continue; if (prob <= info[i].prob) { if (info[i].dwVnum == 50001) { DWORD * pdw = M2_NEW DWORD[2]; pdw[0] = info[i].dwVnum; pdw[1] = info[i].count; DBManager::instance().ReturnQuery(QID_LOTTO, GetPlayerID(), pdw, "INSERT INTO lotto_list VALUES(0, 'server%s', %u, NOW())", get_table_postfix(), GetPlayerID()); } else AutoGiveItem(info[i].dwVnum, info[i].count); break; } prob -= info[i].prob; } } char chatbuf[CHAT_MAX_LEN + 1]; int len = snprintf(chatbuf, sizeof(chatbuf), "StoneDetect %u 0 0", (DWORD)GetVID()); if (len < 0 || len >= (int) sizeof(chatbuf)) len = sizeof(chatbuf) - 1; ++len; TPacketGCChat pack_chat; pack_chat.header = HEADER_GC_CHAT; pack_chat.size = sizeof(TPacketGCChat) + len; pack_chat.type = CHAT_TYPE_COMMAND; pack_chat.id = 0; pack_chat.bEmpire = GetDesc()->GetEmpire(); //pack_chat.id = vid; TEMP_BUFFER buf; buf.write(&pack_chat, sizeof(TPacketGCChat)); buf.write(chatbuf, len); PacketAround(buf.read_peek(), buf.size()); ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (DETECT_EVENT_STONE) 1"); return true; } else if (distance < 20000) dist = 1; else if (distance < 70000) dist = 2; else dist = 3; const int STONE_DETECT_MAX_TRY = 10; if (item->GetSocket(0) >= STONE_DETECT_MAX_TRY) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À̺¥Æ®¿ë °¨Áö±â°¡ ÈçÀûµµ ¾øÀÌ »ç¶óÁı´Ï´Ù.")); ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (DETECT_EVENT_STONE) 0"); AutoGiveItem(27002); return true; } if (dist) { char chatbuf[CHAT_MAX_LEN + 1]; int len = snprintf(chatbuf, sizeof(chatbuf), "StoneDetect %u %d %d", (DWORD)GetVID(), dist, (int)GetDegreeFromPositionXY(GetX(), item->GetSocket(2), item->GetSocket(1), GetY())); if (len < 0 || len >= (int) sizeof(chatbuf)) len = sizeof(chatbuf) - 1; ++len; TPacketGCChat pack_chat; pack_chat.header = HEADER_GC_CHAT; pack_chat.size = sizeof(TPacketGCChat) + len; pack_chat.type = CHAT_TYPE_COMMAND; pack_chat.id = 0; pack_chat.bEmpire = GetDesc()->GetEmpire(); //pack_chat.id = vid; TEMP_BUFFER buf; buf.write(&pack_chat, sizeof(TPacketGCChat)); buf.write(chatbuf, len); PacketAround(buf.read_peek(), buf.size()); } } break; case 27989: case 76006: { LPSECTREE_MAP pMap = SECTREE_MANAGER::instance().GetMap(GetMapIndex()); if (pMap != NULL) { item->SetSocket(0, item->GetSocket(0) + 1); FFindStone f; // <Factor> SECTREE::for_each -> SECTREE::for_each_entity pMap->for_each(f); if (f.m_mapStone.size() > 0) { std::map<DWORD, LPCHARACTER>::iterator stone = f.m_mapStone.begin(); DWORD max = UINT_MAX; LPCHARACTER pTarget = stone->second; while (stone != f.m_mapStone.end()) { DWORD dist = (DWORD)DISTANCE_SQRT(GetX()-stone->second->GetX(), GetY()-stone->second->GetY()); if (dist != 0 && max > dist) { max = dist; pTarget = stone->second; } stone++; } if (pTarget != NULL) { int val = 3; if (max < 10000) val = 2; else if (max < 70000) val = 1; ChatPacket(CHAT_TYPE_COMMAND, "StoneDetect %u %d %d", (DWORD)GetVID(), val, (int)GetDegreeFromPositionXY(GetX(), pTarget->GetY(), pTarget->GetX(), GetY())); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°¨Áö±â¸¦ ÀÛ¿ëÇÏ¿´À¸³ª °¨ÁöµÇ´Â ¿µ¼®ÀÌ ¾ø½À´Ï´Ù.")); } } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°¨Áö±â¸¦ ÀÛ¿ëÇÏ¿´À¸³ª °¨ÁöµÇ´Â ¿µ¼®ÀÌ ¾ø½À´Ï´Ù.")); } if (item->GetSocket(0) >= 6) { ChatPacket(CHAT_TYPE_COMMAND, "StoneDetect %u 0 0", (DWORD)GetVID()); ITEM_MANAGER::instance().RemoveItem(item); } } break; } break; case 39023: if(int(GetQuestFlag("bio.sans")) == 1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biosanszatenaktif")); } else if(GetQuestFlag("bio.durum") == 31 || GetQuestFlag("bio.durum") == 41 || GetQuestFlag("bio.durum") == 51 || GetQuestFlag("bio.durum") == 61 || GetQuestFlag("bio.durum") == 71 || GetQuestFlag("bio.durum") == 81 || GetQuestFlag("bio.durum") == 91 || GetQuestFlag("bio.durum") == 93 || GetQuestFlag("bio.durum") == 11) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biogorevinyok")); ChatPacket(CHAT_TYPE_COMMAND, "biyolog 0 0 0 0"); } else if(GetQuestFlag("bio.ruhtasi") == 1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("bioruhdayapamazsin")); } else { item->SetCount(item->GetCount() - 1); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biosansverildi")); SetQuestFlag("bio.sans",1); } break; case 31029: if(int(GetQuestFlag("bio.sure")) == 1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biosurezatenaktif")); } else if(GetQuestFlag("bio.durum") == 31 || GetQuestFlag("bio.durum") == 41 || GetQuestFlag("bio.durum") == 51 || GetQuestFlag("bio.durum") == 61 || GetQuestFlag("bio.durum") == 71 || GetQuestFlag("bio.durum") == 81 || GetQuestFlag("bio.durum") == 91 || GetQuestFlag("bio.durum") == 93 || GetQuestFlag("bio.durum") == 11) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biogorevinyok")); ChatPacket(CHAT_TYPE_COMMAND, "biyolog 0 0 0 0"); } else if(GetQuestFlag("bio.ruhtasi") == 1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("bioruhdayapamazsin")); } else { item->SetCount(item->GetCount() - 1); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biosureverildi")); SetQuestFlag("bio.sure",1); SetQuestFlag("bio.kalan",0); ChatPacket(CHAT_TYPE_COMMAND, "biyolog %d %d %d %d ", BiyologSistemi[GetQuestFlag("bio.durum")][0], GetQuestFlag("bio.verilen"), BiyologSistemi[GetQuestFlag("bio.durum")][1], GetQuestFlag("bio.kalan")); } break; case 31030: if(int(GetQuestFlag("bio.sure")) == 1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biosurezatenaktif")); } else if(GetQuestFlag("bio.durum") == 31 || GetQuestFlag("bio.durum") == 41 || GetQuestFlag("bio.durum") == 51 || GetQuestFlag("bio.durum") == 61 || GetQuestFlag("bio.durum") == 71 || GetQuestFlag("bio.durum") == 81 || GetQuestFlag("bio.durum") == 91 || GetQuestFlag("bio.durum") == 93 || GetQuestFlag("bio.durum") == 11) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biogorevinyok")); ChatPacket(CHAT_TYPE_COMMAND, "biyolog 0 0 0 0"); } else { item->SetCount(item->GetCount() - 1); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biosureverildi")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("biosansverildi")); SetQuestFlag("bio.sure",1); SetQuestFlag("bio.sans",1); SetQuestFlag("bio.kalan",0); ChatPacket(CHAT_TYPE_COMMAND, "biyolog %d %d %d %d ", BiyologSistemi[GetQuestFlag("bio.durum")][0], GetQuestFlag("bio.verilen"), BiyologSistemi[GetQuestFlag("bio.durum")][1], GetQuestFlag("bio.kalan")); } break; case 27996: item->SetCount(item->GetCount() - 1); AttackedByPoison(NULL); // @warme008 break; case 27987: // 30 ²Î { item->SetCount(item->GetCount() - 1); int r = number(1, 100); if (r <= 50) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á¶°³¿¡¼­ µ¹Á¶°¢ÀÌ ³ª¿Ô½À´Ï´Ù.")); AutoGiveItem(27990); } else { const int prob_table_gb2312[] = { 95, 97, 99 }; const int * prob_table = prob_table_gb2312; if (r <= prob_table[0]) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á¶°³°¡ ÈçÀûµµ ¾øÀÌ »ç¶óÁı´Ï´Ù.")); } else if (r <= prob_table[1]) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á¶°³¿¡¼­ ¹éÁøÁÖ°¡ ³ª¿Ô½À´Ï´Ù.")); AutoGiveItem(27992); } else if (r <= prob_table[2]) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á¶°³¿¡¼­ ûÁøÁÖ°¡ ³ª¿Ô½À´Ï´Ù.")); AutoGiveItem(27993); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á¶°³¿¡¼­ ÇÇÁøÁÖ°¡ ³ª¿Ô½À´Ï´Ù.")); AutoGiveItem(27994); } } } break; #ifdef ENABLE_12ZI case 72327: //Pergamino de esferas (h) case 72329: //Pergamino de esferas { if (GetExchange() || IsOpenSafebox() || GetShopOwner() || IsCubeOpen() # ifdef ENABLE_COSTUME_ATTR_TRANSFER || IsAttrTransferOpen() # endif # ifdef ENABLE_AURA_SYSTEM || IsAuraWindowOpen() # endif # ifdef ENABLE_GUILSTORAGE_SYSTEM || IsOpenGuildstorage() # endif ) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can not use this while you have an open window.")); return false; } SetAnimaSphere(30); item->SetCount(item->GetCount() - 1); } break; case 72328: //Smbolo del guardian { if (FindAffect(AFFECT_CZ_UNLIMIT_ENTER)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù.")); return false; } AddAffect(AFFECT_CZ_UNLIMIT_ENTER, 0, 0, AFF_CZ_UNLIMIT_ENTER, 10800, 0, false); SetQuestFlag("12zi_temple.MarkTime", get_global_time() + 10800); item->SetCount(item->GetCount() - 1); } break; #endif case 71013: CreateFly(number(FLY_FIREWORK1, FLY_FIREWORK6), this); item->SetCount(item->GetCount() - 1); break; case 50100: case 50101: case 50102: case 50103: case 50104: case 50105: case 50106: CreateFly(item->GetVnum() - 50100 + FLY_FIREWORK1, this); item->SetCount(item->GetCount() - 1); break; case 50200: if (g_bEnableBootaryCheck) { if (IS_BOTARYABLE_ZONE(GetMapIndex()) == true) { __OpenPrivateShop(); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³ÀÎ »óÁ¡À» ¿­ ¼ö ¾ø´Â Áö¿ªÀÔ´Ï´Ù")); } } else { __OpenPrivateShop(); } break; case fishing::FISH_MIND_PILL_VNUM: AddAffect(AFFECT_FISH_MIND_PILL, POINT_NONE, 0, AFF_FISH_MIND, 20*60, 0, true); item->SetCount(item->GetCount() - 1); break; case 50301: case 50302: case 50303: { if (IsPolymorphed() == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µĞ°© Áß¿¡´Â ´É·ÂÀ» ¿Ã¸± ¼ö ¾ø½À´Ï´Ù.")); return false; } int lv = GetSkillLevel(SKILL_LEADERSHIP); if (lv < item->GetValue(0)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ Ã¥Àº ³Ê¹« ¾î·Á¿ö ÀÌÇØÇϱⰡ Èûµì´Ï´Ù.")); return false; } if (lv >= item->GetValue(1)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ Ã¥Àº ¾Æ¹«¸® ºÁµµ µµ¿òÀÌ µÉ °Í °°Áö ¾Ê½À´Ï´Ù.")); return false; } if (LearnSkillByBook(SKILL_LEADERSHIP)) { #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; SetSkillNextReadTime(SKILL_LEADERSHIP, get_global_time() + iReadDelay); } } break; case 50304: case 50305: case 50306: { if (IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯½ÅÁß¿¡´Â Ã¥À» ÀĞÀ»¼ö ¾ø½À´Ï´Ù.")); return false; } if (GetSkillLevel(SKILL_COMBO) == 0 && GetLevel() < 30) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("·¹º§ 30ÀÌ µÇ±â Àü¿¡´Â ½ÀµæÇÒ ¼ö ÀÖÀ» °Í °°Áö ¾Ê½À´Ï´Ù.")); return false; } if (GetSkillLevel(SKILL_COMBO) == 1 && GetLevel() < 50) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("·¹º§ 50ÀÌ µÇ±â Àü¿¡´Â ½ÀµæÇÒ ¼ö ÀÖÀ» °Í °°Áö ¾Ê½À´Ï´Ù.")); return false; } if (GetSkillLevel(SKILL_COMBO) >= 2) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿¬°è±â´Â ´õÀÌ»ó ¼ö·ÃÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } int iPct = item->GetValue(0); if (LearnSkillByBook(SKILL_COMBO, iPct)) { #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; SetSkillNextReadTime(SKILL_COMBO, get_global_time() + iReadDelay); } } break; case 50311: case 50312: case 50313: { if (IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯½ÅÁß¿¡´Â Ã¥À» ÀĞÀ»¼ö ¾ø½À´Ï´Ù.")); return false; } DWORD dwSkillVnum = item->GetValue(0); int iPct = MINMAX(0, item->GetValue(1), 100); if (GetSkillLevel(dwSkillVnum)>=20 || dwSkillVnum-SKILL_LANGUAGE1+1 == GetEmpire()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì ¿Ïº®ÇÏ°Ô ¾Ë¾ÆµéÀ» ¼ö ÀÖ´Â ¾ğ¾îÀÌ´Ù.")); return false; } if (LearnSkillByBook(dwSkillVnum, iPct)) { #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay); } } break; case 50061 : { if (IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯½ÅÁß¿¡´Â Ã¥À» ÀĞÀ»¼ö ¾ø½À´Ï´Ù.")); return false; } DWORD dwSkillVnum = item->GetValue(0); int iPct = MINMAX(0, item->GetValue(1), 100); if (GetSkillLevel(dwSkillVnum) >= 10) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó ¼ö·ÃÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (LearnSkillByBook(dwSkillVnum, iPct)) { #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay); } } break; case 50314: case 50315: case 50316: case 50323: case 50324: case 50325: case 50326: { if (IsPolymorphed() == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µĞ°© Áß¿¡´Â ´É·ÂÀ» ¿Ã¸± ¼ö ¾ø½À´Ï´Ù.")); return false; } int iSkillLevelLowLimit = item->GetValue(0); int iSkillLevelHighLimit = item->GetValue(1); int iPct = MINMAX(0, item->GetValue(2), 100); int iLevelLimit = item->GetValue(3); DWORD dwSkillVnum = 0; switch (item->GetVnum()) { case 50314: case 50315: case 50316: dwSkillVnum = SKILL_POLYMORPH; break; case 50323: case 50324: dwSkillVnum = SKILL_ADD_HP; break; case 50325: case 50326: dwSkillVnum = SKILL_RESIST_PENETRATE; break; default: return false; } if (0 == dwSkillVnum) return false; if (GetLevel() < iLevelLimit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ Ã¥À» ÀĞÀ¸·Á¸é ·¹º§À» ´õ ¿Ã·Á¾ß ÇÕ´Ï´Ù.")); return false; } if (GetSkillLevel(dwSkillVnum) >= 40) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó ¼ö·ÃÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (GetSkillLevel(dwSkillVnum) < iSkillLevelLowLimit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ Ã¥Àº ³Ê¹« ¾î·Á¿ö ÀÌÇØÇϱⰡ Èûµì´Ï´Ù.")); return false; } if (GetSkillLevel(dwSkillVnum) >= iSkillLevelHighLimit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ Ã¥À¸·Î´Â ´õ ÀÌ»ó ¼ö·ÃÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (LearnSkillByBook(dwSkillVnum, iPct)) { #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay); } } break; case 50902: case 50903: case 50904: { if (IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯½ÅÁß¿¡´Â Ã¥À» ÀĞÀ»¼ö ¾ø½À´Ï´Ù.")); return false; } DWORD dwSkillVnum = SKILL_CREATE; int iPct = MINMAX(0, item->GetValue(1), 100); if (GetSkillLevel(dwSkillVnum)>=40) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó ¼ö·ÃÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (LearnSkillByBook(dwSkillVnum, iPct)) { #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay); if (test_server) { ChatPacket(CHAT_TYPE_INFO, "[TEST_SERVER] Success to learn skill "); } } else { if (test_server) { ChatPacket(CHAT_TYPE_INFO, "[TEST_SERVER] Failed to learn skill "); } } } break; // MINING case ITEM_MINING_SKILL_TRAIN_BOOK: { if (IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯½ÅÁß¿¡´Â Ã¥À» ÀĞÀ»¼ö ¾ø½À´Ï´Ù.")); return false; } DWORD dwSkillVnum = SKILL_MINING; int iPct = MINMAX(0, item->GetValue(1), 100); if (GetSkillLevel(dwSkillVnum)>=40) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó ¼ö·ÃÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (LearnSkillByBook(dwSkillVnum, iPct)) { #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay); } } break; // END_OF_MINING case ITEM_HORSE_SKILL_TRAIN_BOOK: { if (IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯½ÅÁß¿¡´Â Ã¥À» ÀĞÀ»¼ö ¾ø½À´Ï´Ù.")); return false; } DWORD dwSkillVnum = SKILL_HORSE; int iPct = MINMAX(0, item->GetValue(1), 100); if (GetLevel() < 50) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ ½Â¸¶ ½ºÅ³À» ¼ö·ÃÇÒ ¼ö ÀÖ´Â ·¹º§ÀÌ ¾Æ´Õ´Ï´Ù.")); return false; } if (!test_server && get_global_time() < GetSkillNextReadTime(dwSkillVnum)) { if (FindAffect(AFFECT_SKILL_NO_BOOK_DELAY)) { RemoveAffect(AFFECT_SKILL_NO_BOOK_DELAY); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á־ȼú¼­¸¦ ÅëÇØ ÁÖÈ­ÀÔ¸¶¿¡¼­ ºüÁ®³ª¿Ô½À´Ï´Ù.")); } else { SkillLearnWaitMoreTimeMessage(GetSkillNextReadTime(dwSkillVnum) - get_global_time()); return false; } } if (GetPoint(POINT_HORSE_SKILL) >= 20 || GetSkillLevel(SKILL_HORSE_WILDATTACK) + GetSkillLevel(SKILL_HORSE_CHARGE) + GetSkillLevel(SKILL_HORSE_ESCAPE) >= 60 || GetSkillLevel(SKILL_HORSE_WILDATTACK_RANGE) + GetSkillLevel(SKILL_HORSE_CHARGE) + GetSkillLevel(SKILL_HORSE_ESCAPE) >= 60) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó ½Â¸¶ ¼ö·Ã¼­¸¦ ÀĞÀ» ¼ö ¾ø½À´Ï´Ù.")); return false; } if (number(1, 100) <= iPct) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("½Â¸¶ ¼ö·Ã¼­¸¦ ÀĞ¾î ½Â¸¶ ½ºÅ³ Æ÷ÀÎÆ®¸¦ ¾ò¾ú½À´Ï´Ù.")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾òÀº Æ÷ÀÎÆ®·Î´Â ½Â¸¶ ½ºÅ³ÀÇ ·¹º§À» ¿Ã¸± ¼ö ÀÖ½À´Ï´Ù.")); PointChange(POINT_HORSE_SKILL, 1); int iReadDelay = number(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX); if (distribution_test_server) iReadDelay /= 3; if (!test_server) SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("½Â¸¶ ¼ö·Ã¼­ ÀÌÇØ¿¡ ½ÇÆĞÇÏ¿´½À´Ï´Ù.")); } #ifdef ENABLE_BOOKS_STACKFIX item->SetCount(item->GetCount() - 1); #else ITEM_MANAGER::instance().RemoveItem(item); #endif } break; case 70102: case 70103: { if (GetAlignment() >= 0) return false; int delta = MIN(-GetAlignment(), item->GetValue(0)); sys_log(0, "%s ALIGNMENT ITEM %d", GetName(), delta); UpdateAlignment(delta); item->SetCount(item->GetCount() - 1); if (delta / 10 > 0) { ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("¸¶À½ÀÌ ¸¼¾ÆÁö´Â±º. °¡½¿À» Áş´©¸£´ø ¹«¾ğ°¡°¡ Á» °¡º­¿öÁø ´À³¦À̾ß.")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼±¾ÇÄ¡°¡ %d Áõ°¡ÇÏ¿´½À´Ï´Ù."), delta/10); } } break; case 71107: { int val = item->GetValue(0); int interval = item->GetValue(1); quest::PC* pPC = quest::CQuestManager::instance().GetPC(GetPlayerID()); int last_use_time = pPC->GetFlag("mythical_peach.last_use_time"); if (get_global_time() - last_use_time < interval * 60 * 60) { if (test_server == false) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Å×½ºÆ® ¼­¹ö ½Ã°£Á¦ÇÑ Åë°ú")); } } if (GetAlignment() == 200000) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼±¾ÇÄ¡¸¦ ´õ ÀÌ»ó ¿Ã¸± ¼ö ¾ø½À´Ï´Ù.")); return false; } if (200000 - GetAlignment() < val * 10) { val = (200000 - GetAlignment()) / 10; } int old_alignment = GetAlignment() / 10; UpdateAlignment(val*10); item->SetCount(item->GetCount()-1); pPC->SetFlag("mythical_peach.last_use_time", get_global_time()); ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("¸¶À½ÀÌ ¸¼¾ÆÁö´Â±º. °¡½¿À» Áş´©¸£´ø ¹«¾ğ°¡°¡ Á» °¡º­¿öÁø ´À³¦À̾ß.")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼±¾ÇÄ¡°¡ %d Áõ°¡ÇÏ¿´½À´Ï´Ù."), val); char buf[256 + 1]; snprintf(buf, sizeof(buf), "%d %d", old_alignment, GetAlignment() / 10); LogManager::instance().CharLog(this, val, "MYTHICAL_PEACH", buf); } break; case 71109: case 72719: { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114 return false; if (item2->GetSocketCount() == 0) return false; switch( item2->GetType() ) { case ITEM_WEAPON: break; case ITEM_ARMOR: switch (item2->GetSubType()) { case ARMOR_EAR: case ARMOR_WRIST: case ARMOR_NECK: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»©³¾ ¿µ¼®ÀÌ ¾ø½À´Ï´Ù")); return false; } break; default: return false; } std::stack<long> socket; for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) socket.push(item2->GetSocket(i)); int idx = ITEM_SOCKET_MAX_NUM - 1; while (socket.size() > 0) { if (socket.top() > 2 && socket.top() != ITEM_BROKEN_METIN_VNUM) break; idx--; socket.pop(); } if (socket.size() == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»©³¾ ¿µ¼®ÀÌ ¾ø½À´Ï´Ù")); return false; } LPITEM pItemReward = AutoGiveItem(socket.top()); if (pItemReward != NULL) { item2->SetSocket(idx, 1); char buf[256+1]; snprintf(buf, sizeof(buf), "%s(%u) %s(%u)", item2->GetName(), item2->GetID(), pItemReward->GetName(), pItemReward->GetID()); LogManager::instance().ItemLog(this, item, "USE_DETACHMENT_ONE", buf); item->SetCount(item->GetCount() - 1); } } break; case 70201: case 70202: case 70203: case 70204: case 70205: case 70206: { // NEW_HAIR_STYLE_ADD if (GetPart(PART_HAIR) >= 1001) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÇöÀç Çì¾î½ºÅ¸ÀÏ¿¡¼­´Â ¿°»ö°ú Å»»öÀÌ ºÒ°¡´ÉÇÕ´Ï´Ù.")); } // END_NEW_HAIR_STYLE_ADD else { quest::CQuestManager& q = quest::CQuestManager::instance(); quest::PC* pPC = q.GetPC(GetPlayerID()); if (pPC) { int last_dye_level = pPC->GetFlag("dyeing_hair.last_dye_level"); if (last_dye_level == 0 || last_dye_level+3 <= GetLevel() || item->GetVnum() == 70201) { SetPart(PART_HAIR, item->GetVnum() - 70201); if (item->GetVnum() == 70201) pPC->SetFlag("dyeing_hair.last_dye_level", 0); else pPC->SetFlag("dyeing_hair.last_dye_level", GetLevel()); item->SetCount(item->GetCount() - 1); UpdatePacket(); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d ·¹º§ÀÌ µÇ¾î¾ß ´Ù½Ã ¿°»öÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù."), last_dye_level+3); } } } } break; case ITEM_NEW_YEAR_GREETING_VNUM: { DWORD dwBoxVnum = ITEM_NEW_YEAR_GREETING_VNUM; std::vector <DWORD> dwVnums; std::vector <DWORD> dwCounts; std::vector <LPITEM> item_gets; int count = 0; if (GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count)) { for (int i = 0; i < count; i++) { if (dwVnums[i] == CSpecialItemGroup::GOLD) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µ· %d ³ÉÀ» ȹµæÇß½À´Ï´Ù."), dwCounts[i]); } item->SetCount(item->GetCount() - 1); } } break; case ITEM_VALENTINE_ROSE: case ITEM_VALENTINE_CHOCOLATE: { DWORD dwBoxVnum = item->GetVnum(); std::vector <DWORD> dwVnums; std::vector <DWORD> dwCounts; std::vector <LPITEM> item_gets(0); int count = 0; if (((item->GetVnum() == ITEM_VALENTINE_ROSE) && (SEX_MALE==GET_SEX(this))) || ((item->GetVnum() == ITEM_VALENTINE_CHOCOLATE) && (SEX_FEMALE==GET_SEX(this)))) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ºº°ÀÌ ¸ÂÁö¾Ê¾Æ ÀÌ ¾ÆÀÌÅÛÀ» ¿­ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count)) item->SetCount(item->GetCount()-1); } break; case ITEM_WHITEDAY_CANDY: case ITEM_WHITEDAY_ROSE: { DWORD dwBoxVnum = item->GetVnum(); std::vector <DWORD> dwVnums; std::vector <DWORD> dwCounts; std::vector <LPITEM> item_gets(0); int count = 0; if (((item->GetVnum() == ITEM_WHITEDAY_CANDY) && (SEX_MALE==GET_SEX(this))) || ((item->GetVnum() == ITEM_WHITEDAY_ROSE) && (SEX_FEMALE==GET_SEX(this)))) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ºº°ÀÌ ¸ÂÁö¾Ê¾Æ ÀÌ ¾ÆÀÌÅÛÀ» ¿­ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count)) item->SetCount(item->GetCount()-1); } break; case 50011: { DWORD dwBoxVnum = 50011; std::vector <DWORD> dwVnums; std::vector <DWORD> dwCounts; std::vector <LPITEM> item_gets(0); int count = 0; if (GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count)) { for (int i = 0; i < count; i++) { char buf[50 + 1]; snprintf(buf, sizeof(buf), "%u %u", dwVnums[i], dwCounts[i]); LogManager::instance().ItemLog(this, item, "MOONLIGHT_GET", buf); //ITEM_MANAGER::instance().RemoveItem(item); item->SetCount(item->GetCount() - 1); switch (dwVnums[i]) { case CSpecialItemGroup::GOLD: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µ· %d ³ÉÀ» ȹµæÇß½À´Ï´Ù."), dwCounts[i]); break; case CSpecialItemGroup::EXP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ºÎÅÍ ½ÅºñÇÑ ºûÀÌ ³ª¿É´Ï´Ù.")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%dÀÇ °æÇèÄ¡¸¦ ȹµæÇß½À´Ï´Ù."), dwCounts[i]); break; case CSpecialItemGroup::MOB: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ¸ó½ºÅÍ°¡ ³ªÅ¸³µ½À´Ï´Ù!")); break; case CSpecialItemGroup::SLOW: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â »¡°£ ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ ¿òÁ÷ÀÌ´Â ¼Óµµ°¡ ´À·ÁÁ³½À´Ï´Ù!")); break; case CSpecialItemGroup::DRAIN_HP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ°¡ °©ÀÚ±â Æø¹ßÇÏ¿´½À´Ï´Ù! »ı¸í·ÂÀÌ °¨¼ÒÇß½À´Ï´Ù.")); break; case CSpecialItemGroup::POISON: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â ³ì»ö ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ µ¶ÀÌ ¿Â¸öÀ¸·Î ÆÛÁı´Ï´Ù!")); break; #ifdef ENABLE_WOLFMAN_CHARACTER case CSpecialItemGroup::BLEEDING: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ³ª¿Â ³ì»ö ¿¬±â¸¦ µéÀ̸¶½ÃÀÚ µ¶ÀÌ ¿Â¸öÀ¸·Î ÆÛÁı´Ï´Ù!")); break; #endif case CSpecialItemGroup::MOB_GROUP: ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ ¸ó½ºÅÍ°¡ ³ªÅ¸³µ½À´Ï´Ù!")); break; default: if (item_gets[i]) { if (dwCounts[i] > 1) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ %s °¡ %d °³ ³ª¿Ô½À´Ï´Ù."), item_gets[i]->GetName(), dwCounts[i]); else ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»óÀÚ¿¡¼­ %s °¡ ³ª¿Ô½À´Ï´Ù."), item_gets[i]->GetName()); } break; } } } else { ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("¾Æ¹«°Íµµ ¾òÀ» ¼ö ¾ø¾ú½À´Ï´Ù.")); return false; } } break; case ITEM_GIVE_STAT_RESET_COUNT_VNUM: { //PointChange(POINT_GOLD, -iCost); PointChange(POINT_STAT_RESET_COUNT, 1); item->SetCount(item->GetCount()-1); } break; case 50107: { if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif EffectPacket(SE_CHINA_FIREWORK); #ifdef ENABLE_FIREWORK_STUN AddAffect(AFFECT_CHINA_FIREWORK, POINT_STUN_PCT, 30, AFF_CHINA_FIREWORK, 5*60, 0, true); #endif item->SetCount(item->GetCount()-1); } break; case 50108: { if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif EffectPacket(SE_SPIN_TOP); #ifdef ENABLE_FIREWORK_STUN AddAffect(AFFECT_CHINA_FIREWORK, POINT_STUN_PCT, 30, AFF_CHINA_FIREWORK, 5*60, 0, true); #endif item->SetCount(item->GetCount()-1); } break; case ITEM_WONSO_BEAN_VNUM: PointChange(POINT_HP, GetMaxHP() - GetHP()); item->SetCount(item->GetCount()-1); break; case ITEM_WONSO_SUGAR_VNUM: PointChange(POINT_SP, GetMaxSP() - GetSP()); item->SetCount(item->GetCount()-1); break; case ITEM_WONSO_FRUIT_VNUM: PointChange(POINT_STAMINA, GetMaxStamina()-GetStamina()); item->SetCount(item->GetCount()-1); break; case 90008: // VCARD case 90009: // VCARD VCardUse(this, this, item); break; case ITEM_ELK_VNUM: { int iGold = item->GetSocket(0); ITEM_MANAGER::instance().RemoveItem(item); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µ· %d ³ÉÀ» ȹµæÇß½À´Ï´Ù."), iGold); PointChange(POINT_GOLD, iGold); } break; case 70021: { int HealPrice = quest::CQuestManager::instance().GetEventFlag("MonarchHealGold"); if (HealPrice == 0) HealPrice = 2000000; if (CMonarch::instance().HealMyEmpire(this, HealPrice)) { char szNotice[256]; snprintf(szNotice, sizeof(szNotice), LC_TEXT("±ºÁÖÀÇ ÃູÀ¸·Î ÀÌÁö¿ª %s À¯Àú´Â HP,SP°¡ ¸ğµÎ ä¿öÁı´Ï´Ù."), EMPIRE_NAME(GetEmpire())); SendNoticeMap(szNotice, GetMapIndex(), false); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±ºÁÖÀÇ ÃູÀ» »ç¿ëÇÏ¿´½À´Ï´Ù.")); } } break; case 27995: { } break; case 71092 : { if (m_pkChrTarget != NULL) { if (m_pkChrTarget->IsPolymorphed()) { m_pkChrTarget->SetPolymorph(0); m_pkChrTarget->RemoveAffect(AFFECT_POLYMORPH); } } else { if (IsPolymorphed()) { SetPolymorph(0); RemoveAffect(AFFECT_POLYMORPH); } } } break; case 71051 : { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetInventoryItem(wDestCell))) return false; if (ITEM_COSTUME == item2->GetType()) // @fixme124 { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114 return false; if (item2->GetAttributeSetIndex() == -1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->AddRareAttribute() == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼º°øÀûÀ¸·Î ¼Ó¼ºÀÌ Ãß°¡ µÇ¾ú½À´Ï´Ù")); int iAddedIdx = item2->GetRareAttrCount() + 4; char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); LogManager::instance().ItemLog( GetPlayerID(), item2->GetAttributeType(iAddedIdx), item2->GetAttributeValue(iAddedIdx), item->GetID(), "ADD_RARE_ATTR", buf, GetDesc()->GetHostName(), item->GetOriginalVnum()); item->SetCount(item->GetCount() - 1); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó ÀÌ ¾ÆÀÌÅÛÀ¸·Î ¼Ó¼ºÀ» Ãß°¡ÇÒ ¼ö ¾ø½À´Ï´Ù")); } } break; case 71052 : { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (ITEM_COSTUME == item2->GetType()) // @fixme124 { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114 return false; if (item2->GetAttributeSetIndex() == -1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->ChangeRareAttribute() == true) { char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); LogManager::instance().ItemLog(this, item, "CHANGE_RARE_ATTR", buf); item->SetCount(item->GetCount() - 1); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯°æ ½Ãų ¼Ó¼ºÀÌ ¾ø½À´Ï´Ù")); } } break; case ITEM_AUTO_HP_RECOVERY_S: case ITEM_AUTO_HP_RECOVERY_M: case ITEM_AUTO_HP_RECOVERY_L: case ITEM_AUTO_HP_RECOVERY_X: case ITEM_AUTO_SP_RECOVERY_S: case ITEM_AUTO_SP_RECOVERY_M: case ITEM_AUTO_SP_RECOVERY_L: case ITEM_AUTO_SP_RECOVERY_X: case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_XS: case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_S: case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_XS: case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_S: case FUCKING_BRAZIL_ITEM_AUTO_SP_RECOVERY_S: case FUCKING_BRAZIL_ITEM_AUTO_HP_RECOVERY_S: { if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.")); return false; } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif EAffectTypes type = AFFECT_NONE; bool isSpecialPotion = false; switch (item->GetVnum()) { case ITEM_AUTO_HP_RECOVERY_X: isSpecialPotion = true; case ITEM_AUTO_HP_RECOVERY_S: case ITEM_AUTO_HP_RECOVERY_M: case ITEM_AUTO_HP_RECOVERY_L: case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_XS: case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_S: case FUCKING_BRAZIL_ITEM_AUTO_HP_RECOVERY_S: type = AFFECT_AUTO_HP_RECOVERY; break; case ITEM_AUTO_SP_RECOVERY_X: isSpecialPotion = true; case ITEM_AUTO_SP_RECOVERY_S: case ITEM_AUTO_SP_RECOVERY_M: case ITEM_AUTO_SP_RECOVERY_L: case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_XS: case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_S: case FUCKING_BRAZIL_ITEM_AUTO_SP_RECOVERY_S: type = AFFECT_AUTO_SP_RECOVERY; break; } if (AFFECT_NONE == type) break; if (item->GetCount() > 1) { int pos = GetEmptyInventory(item->GetSize()); if (-1 == pos) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇ°¿¡ ºó °ø°£ÀÌ ¾ø½À´Ï´Ù.")); break; } item->SetCount( item->GetCount() - 1 ); LPITEM item2 = ITEM_MANAGER::instance().CreateItem( item->GetVnum(), 1 ); item2->AddToCharacter(this, TItemPos(INVENTORY, pos)); if (item->GetSocket(1) != 0) { item2->SetSocket(1, item->GetSocket(1)); } item = item2; } CAffect* pAffect = FindAffect( type ); if (NULL == pAffect) { EPointTypes bonus = POINT_NONE; if (true == isSpecialPotion) { if (type == AFFECT_AUTO_HP_RECOVERY) { bonus = POINT_MAX_HP_PCT; } else if (type == AFFECT_AUTO_SP_RECOVERY) { bonus = POINT_MAX_SP_PCT; } } AddAffect( type, bonus, 4, item->GetID(), INFINITE_AFFECT_DURATION, 0, true, false); item->Lock(true); item->SetSocket(0, true); AutoRecoveryItemProcess( type ); } else { if (item->GetID() == pAffect->dwFlag) { RemoveAffect( pAffect ); item->Lock(false); item->SetSocket(0, false); } else { LPITEM old = FindItemByID( pAffect->dwFlag ); if (NULL != old) { old->Lock(false); old->SetSocket(0, false); } RemoveAffect( pAffect ); EPointTypes bonus = POINT_NONE; if (true == isSpecialPotion) { if (type == AFFECT_AUTO_HP_RECOVERY) { bonus = POINT_MAX_HP_PCT; } else if (type == AFFECT_AUTO_SP_RECOVERY) { bonus = POINT_MAX_SP_PCT; } } AddAffect( type, bonus, 4, item->GetID(), INFINITE_AFFECT_DURATION, 0, true, false); item->Lock(true); item->SetSocket(0, true); AutoRecoveryItemProcess( type ); } } } break; } break; case USE_CLEAR: { switch (item->GetVnum()) { #ifdef ENABLE_WOLFMAN_CHARACTER case 27124: // Bandage RemoveBleeding(); break; #endif case 27874: // Grilled Perch default: RemoveBadAffect(); break; } item->SetCount(item->GetCount() - 1); } break; case USE_INVISIBILITY: { if (item->GetVnum() == 70026) { quest::CQuestManager& q = quest::CQuestManager::instance(); quest::PC* pPC = q.GetPC(GetPlayerID()); if (pPC != NULL) { int last_use_time = pPC->GetFlag("mirror_of_disapper.last_use_time"); if (get_global_time() - last_use_time < 10*60) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } pPC->SetFlag("mirror_of_disapper.last_use_time", get_global_time()); } } AddAffect(AFFECT_INVISIBILITY, POINT_NONE, 0, AFF_INVISIBILITY, 300, 0, true); item->SetCount(item->GetCount() - 1); } break; case USE_POTION_NODELAY: { if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { if (quest::CQuestManager::instance().GetEventFlag("arena_potion_limit") > 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.")); return false; } switch (item->GetVnum()) { case 70020 : case 71018 : case 71019 : case 71020 : if (quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count") < 10000) { if (m_nPotionLimit <= 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç¿ë Á¦ÇÑ·®À» ÃÊ°úÇÏ¿´½À´Ï´Ù.")); return false; } } break; default : ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.")); return false; } } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif bool used = false; if (item->GetValue(0) != 0) { if (GetHP() < GetMaxHP()) { PointChange(POINT_HP, item->GetValue(0) * (100 + GetPoint(POINT_POTION_BONUS)) / 100); EffectPacket(SE_HPUP_RED); used = TRUE; } } if (item->GetValue(1) != 0) { if (GetSP() < GetMaxSP()) { PointChange(POINT_SP, item->GetValue(1) * (100 + GetPoint(POINT_POTION_BONUS)) / 100); EffectPacket(SE_SPUP_BLUE); used = TRUE; } } if (item->GetValue(3) != 0) { if (GetHP() < GetMaxHP()) { PointChange(POINT_HP, item->GetValue(3) * GetMaxHP() / 100); EffectPacket(SE_HPUP_RED); used = TRUE; } } if (item->GetValue(4) != 0) { if (GetSP() < GetMaxSP()) { PointChange(POINT_SP, item->GetValue(4) * GetMaxSP() / 100); EffectPacket(SE_SPUP_BLUE); used = TRUE; } } if (used) { if (item->GetVnum() == 50085 || item->GetVnum() == 50086) { if (test_server) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ùº´ ¶Ç´Â Á¾ÀÚ ¸¦ »ç¿ëÇÏ¿´½À´Ï´Ù")); SetUseSeedOrMoonBottleTime(); } if (GetDungeon()) GetDungeon()->UsePotion(this); if (GetWarMap()) GetWarMap()->UsePotion(this, item); m_nPotionLimit--; //RESTRICT_USE_SEED_OR_MOONBOTTLE item->SetCount(item->GetCount() - 1); //END_RESTRICT_USE_SEED_OR_MOONBOTTLE } } break; case USE_POTION: if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { if (quest::CQuestManager::instance().GetEventFlag("arena_potion_limit") > 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.")); return false; } switch (item->GetVnum()) { case 27001 : case 27002 : case 27003 : case 27004 : case 27005 : case 27006 : if (quest::CQuestManager::instance().GetEventFlag("arena_potion_limit_count") < 10000) { if (m_nPotionLimit <= 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç¿ë Á¦ÇÑ·®À» ÃÊ°úÇÏ¿´½À´Ï´Ù.")); return false; } } break; default : ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ÃÀå¿¡¼­ »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.")); return false; } } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif if (item->GetValue(1) != 0) { if (GetPoint(POINT_SP_RECOVERY) + GetSP() >= GetMaxSP()) { return false; } PointChange(POINT_SP_RECOVERY, item->GetValue(1) * MIN(200, (100 + GetPoint(POINT_POTION_BONUS))) / 100); StartAffectEvent(); EffectPacket(SE_SPUP_BLUE); } if (item->GetValue(0) != 0) { if (GetPoint(POINT_HP_RECOVERY) + GetHP() >= GetMaxHP()) { return false; } PointChange(POINT_HP_RECOVERY, item->GetValue(0) * MIN(200, (100 + GetPoint(POINT_POTION_BONUS))) / 100); StartAffectEvent(); EffectPacket(SE_HPUP_RED); } if (GetDungeon()) GetDungeon()->UsePotion(this); if (GetWarMap()) GetWarMap()->UsePotion(this, item); item->SetCount(item->GetCount() - 1); m_nPotionLimit--; break; case USE_POTION_CONTINUE: { if (item->GetValue(0) != 0) { AddAffect(AFFECT_HP_RECOVER_CONTINUE, POINT_HP_RECOVER_CONTINUE, item->GetValue(0), 0, item->GetValue(2), 0, true); } else if (item->GetValue(1) != 0) { AddAffect(AFFECT_SP_RECOVER_CONTINUE, POINT_SP_RECOVER_CONTINUE, item->GetValue(1), 0, item->GetValue(2), 0, true); } else return false; } if (GetDungeon()) GetDungeon()->UsePotion(this); if (GetWarMap()) GetWarMap()->UsePotion(this, item); item->SetCount(item->GetCount() - 1); break; case USE_ABILITY_UP: { switch (item->GetValue(0)) { case APPLY_MOV_SPEED: if (FindAffect(AFFECT_MOV_SPEED)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("BU_ETKI_DEVAM_EDIYOR")); return false; } AddAffect(AFFECT_MOV_SPEED, POINT_MOV_SPEED, item->GetValue(2), AFF_MOV_SPEED_POTION, item->GetValue(1), 0, true); #ifdef ENABLE_EFFECT_EXTRAPOT EffectPacket(SE_DXUP_PURPLE); #endif break; case APPLY_ATT_SPEED: if (FindAffect(AFFECT_ATT_SPEED)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("BU_ETKI_DEVAM_EDIYOR")); return false; } AddAffect(AFFECT_ATT_SPEED, POINT_ATT_SPEED, item->GetValue(2), AFF_ATT_SPEED_POTION, item->GetValue(1), 0, true); #ifdef ENABLE_EFFECT_EXTRAPOT EffectPacket(SE_SPEEDUP_GREEN); #endif break; case APPLY_STR: AddAffect(AFFECT_STR, POINT_ST, item->GetValue(2), 0, item->GetValue(1), 0, true); break; case APPLY_DEX: AddAffect(AFFECT_DEX, POINT_DX, item->GetValue(2), 0, item->GetValue(1), 0, true); break; case APPLY_CON: AddAffect(AFFECT_CON, POINT_HT, item->GetValue(2), 0, item->GetValue(1), 0, true); break; case APPLY_INT: AddAffect(AFFECT_INT, POINT_IQ, item->GetValue(2), 0, item->GetValue(1), 0, true); break; case APPLY_CAST_SPEED: AddAffect(AFFECT_CAST_SPEED, POINT_CASTING_SPEED, item->GetValue(2), 0, item->GetValue(1), 0, true); break; case APPLY_ATT_GRADE_BONUS: AddAffect(AFFECT_ATT_GRADE, POINT_ATT_GRADE_BONUS, item->GetValue(2), 0, item->GetValue(1), 0, true); break; case APPLY_DEF_GRADE_BONUS: AddAffect(AFFECT_DEF_GRADE, POINT_DEF_GRADE_BONUS, item->GetValue(2), 0, item->GetValue(1), 0, true); break; } } if (GetDungeon()) GetDungeon()->UsePotion(this); if (GetWarMap()) GetWarMap()->UsePotion(this, item); item->SetCount(item->GetCount() - 1); break; case USE_TALISMAN: { const int TOWN_PORTAL = 1; const int MEMORY_PORTAL = 2; if (GetMapIndex() == 200 || GetMapIndex() == 113) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÇöÀç À§Ä¡¿¡¼­ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #ifdef ENABLE_NEWSTUFF else if (g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(item->GetVnum())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·Ã Áß¿¡´Â ÀÌ¿ëÇÒ ¼ö ¾ø´Â ¹°Ç°ÀÔ´Ï´Ù.")); return false; } #endif if (m_pkWarpEvent) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À̵¿ÇÒ Áغñ°¡ µÇ¾îÀÖÀ½À¸·Î ±ÍȯºÎ¸¦ »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù")); return false; } // CONSUME_LIFE_WHEN_USE_WARP_ITEM int consumeLife = CalculateConsume(this); if (consumeLife < 0) return false; // END_OF_CONSUME_LIFE_WHEN_USE_WARP_ITEM if (item->GetValue(0) == TOWN_PORTAL) { if (item->GetSocket(0) == 0) { if (!GetDungeon()) if (!GiveRecallItem(item)) return false; PIXEL_POSITION posWarp; if (SECTREE_MANAGER::instance().GetRecallPositionByEmpire(GetMapIndex(), GetEmpire(), posWarp)) { // CONSUME_LIFE_WHEN_USE_WARP_ITEM PointChange(POINT_HP, -consumeLife, false); // END_OF_CONSUME_LIFE_WHEN_USE_WARP_ITEM WarpSet(posWarp.x, posWarp.y); } else { sys_err("CHARACTER::UseItem : cannot find spawn position (name %s, %d x %d)", GetName(), GetX(), GetY()); } } else { if (test_server) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿ø·¡ À§Ä¡·Î º¹±Í")); ProcessRecallItem(item); } } else if (item->GetValue(0) == MEMORY_PORTAL) { if (item->GetSocket(0) == 0) { if (GetDungeon()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´øÀü ¾È¿¡¼­´Â %s%s »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."), item->GetName(), ""); return false; } if (!GiveRecallItem(item)) return false; } else { // CONSUME_LIFE_WHEN_USE_WARP_ITEM PointChange(POINT_HP, -consumeLife, false); // END_OF_CONSUME_LIFE_WHEN_USE_WARP_ITEM ProcessRecallItem(item); } } } break; case USE_TUNING: case USE_DETACHMENT: { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114 return false; if (item2->GetVnum() >= 28330 && item2->GetVnum() <= 28343) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("+3 ¿µ¼®Àº ÀÌ ¾ÆÀÌÅÛÀ¸·Î °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù")); return false; } #ifdef ENABLE_ACCE_SYSTEM if (item->GetValue(0) == ACCE_CLEAN_ATTR_VALUE0) { if (!CleanAcceAttr(item, item2)) return false; return true; } #endif if (item2->GetVnum() >= 28430 && item2->GetVnum() <= 28443) { if (item->GetVnum() == 71056) { RefineItem(item, item2); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¿µ¼®Àº ÀÌ ¾ÆÀÌÅÛÀ¸·Î °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù")); } } else { RefineItem(item, item2); } } break; case USE_CHANGE_COSTUME_ATTR: case USE_RESET_COSTUME_ATTR: { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsEquipped()) { BuffOnAttr_RemoveBuffsFromItem(item2); } if (ITEM_COSTUME != item2->GetType()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114 return false; if (item2->GetAttributeSetIndex() == -1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->GetAttributeCount() == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯°æÇÒ ¼Ó¼ºÀÌ ¾ø½À´Ï´Ù.")); return false; } switch (item->GetSubType()) { case USE_CHANGE_COSTUME_ATTR: item2->ChangeAttribute(); { char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); LogManager::instance().ItemLog(this, item, "CHANGE_COSTUME_ATTR", buf); } break; case USE_RESET_COSTUME_ATTR: item2->ClearAttribute(); item2->AlterToMagicItem(); { char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); LogManager::instance().ItemLog(this, item, "RESET_COSTUME_ATTR", buf); } break; } ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÏ¿´½À´Ï´Ù.")); item->SetCount(item->GetCount() - 1); break; } // ACCESSORY_REFINE & ADD/CHANGE_ATTRIBUTES case USE_PUT_INTO_BELT_SOCKET: case USE_PUT_INTO_RING_SOCKET: case USE_PUT_INTO_ACCESSORY_SOCKET: case USE_ADD_ACCESSORY_SOCKET: case USE_CLEAN_SOCKET: case USE_CHANGE_ATTRIBUTE: case USE_CHANGE_ATTRIBUTE2 : case USE_ADD_ATTRIBUTE: case USE_ADD_ATTRIBUTE2: { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsEquipped()) { BuffOnAttr_RemoveBuffsFromItem(item2); } if (ITEM_COSTUME == item2->GetType()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114 return false; switch (item->GetSubType()) { case USE_CLEAN_SOCKET: { int i; for (i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { if (item2->GetSocket(i) == ITEM_BROKEN_METIN_VNUM) break; } if (i == ITEM_SOCKET_MAX_NUM) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("û¼ÒÇÒ ¼®ÀÌ ¹ÚÇôÀÖÁö ¾Ê½À´Ï´Ù.")); return false; } int j = 0; for (i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { if (item2->GetSocket(i) != ITEM_BROKEN_METIN_VNUM && item2->GetSocket(i) != 0) item2->SetSocket(j++, item2->GetSocket(i)); } for (; j < ITEM_SOCKET_MAX_NUM; ++j) { if (item2->GetSocket(j) > 0) item2->SetSocket(j, 1); } { char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); LogManager::instance().ItemLog(this, item, "CLEAN_SOCKET", buf); } item->SetCount(item->GetCount() - 1); } break; case USE_CHANGE_ATTRIBUTE : case USE_CHANGE_ATTRIBUTE2 : // @fixme123 if (item2->GetAttributeSetIndex() == -1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->GetAttributeCount() == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("º¯°æÇÒ ¼Ó¼ºÀÌ ¾ø½À´Ï´Ù.")); return false; } if ((GM_PLAYER == GetGMLevel()) && (false == test_server) && (g_dwItemBonusChangeTime > 0)) { // // // DWORD dwChangeItemAttrCycle = quest::CQuestManager::instance().GetEventFlag(msc_szChangeItemAttrCycleFlag); // if (dwChangeItemAttrCycle < msc_dwDefaultChangeItemAttrCycle) // dwChangeItemAttrCycle = msc_dwDefaultChangeItemAttrCycle; DWORD dwChangeItemAttrCycle = g_dwItemBonusChangeTime; quest::PC* pPC = quest::CQuestManager::instance().GetPC(GetPlayerID()); if (pPC) { DWORD dwNowSec = get_global_time(); DWORD dwLastChangeItemAttrSec = pPC->GetFlag(msc_szLastChangeItemAttrFlag); if (dwLastChangeItemAttrSec + dwChangeItemAttrCycle > dwNowSec) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» ¹Ù²ÛÁö %dºĞ À̳»¿¡´Â ´Ù½Ã º¯°æÇÒ ¼ö ¾ø½À´Ï´Ù.(%d ºĞ ³²À½)"), dwChangeItemAttrCycle, dwChangeItemAttrCycle - (dwNowSec - dwLastChangeItemAttrSec)); return false; } pPC->SetFlag(msc_szLastChangeItemAttrFlag, dwNowSec); } } if (item->GetSubType() == USE_CHANGE_ATTRIBUTE2) { int aiChangeProb[ITEM_ATTRIBUTE_MAX_LEVEL] = { 0, 0, 30, 40, 3 }; item2->ChangeAttribute(aiChangeProb); } else if (item->GetVnum() == 76014) { int aiChangeProb[ITEM_ATTRIBUTE_MAX_LEVEL] = { 0, 10, 50, 39, 1 }; item2->ChangeAttribute(aiChangeProb); } else { if (item->GetVnum() == 71151 || item->GetVnum() == 76023) { if ((item2->GetType() == ITEM_WEAPON) || (item2->GetType() == ITEM_ARMOR && item2->GetSubType() == ARMOR_BODY)) { bool bCanUse = true; for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) { if (item2->GetLimitType(i) == LIMIT_LEVEL && item2->GetLimitValue(i) > 40) { bCanUse = false; break; } } if (false == bCanUse) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Àû¿ë ·¹º§º¸´Ù ³ô¾Æ »ç¿ëÀÌ ºÒ°¡´ÉÇÕ´Ï´Ù.")); break; } } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹«±â¿Í °©¿Ê¿¡¸¸ »ç¿ë °¡´ÉÇÕ´Ï´Ù.")); break; } } item2->ChangeAttribute(); } ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÏ¿´½À´Ï´Ù.")); { char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); LogManager::instance().ItemLog(this, item, "CHANGE_ATTRIBUTE", buf); } item->SetCount(item->GetCount() - 1); break; case USE_ADD_ATTRIBUTE : if (item2->GetAttributeSetIndex() == -1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->GetAttributeCount() < 4) { if (item->GetVnum() == 71152 || item->GetVnum() == 76024) { if ((item2->GetType() == ITEM_WEAPON) || (item2->GetType() == ITEM_ARMOR && item2->GetSubType() == ARMOR_BODY)) { bool bCanUse = true; for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) { if (item2->GetLimitType(i) == LIMIT_LEVEL && item2->GetLimitValue(i) > 40) { bCanUse = false; break; } } if (false == bCanUse) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Àû¿ë ·¹º§º¸´Ù ³ô¾Æ »ç¿ëÀÌ ºÒ°¡´ÉÇÕ´Ï´Ù.")); break; } } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹«±â¿Í °©¿Ê¿¡¸¸ »ç¿ë °¡´ÉÇÕ´Ï´Ù.")); break; } } char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); if (number(1, 100) <= aiItemAttributeAddPercent[item2->GetAttributeCount()]) { item2->AddAttribute(); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼º Ãß°¡¿¡ ¼º°øÇÏ¿´½À´Ï´Ù.")); int iAddedIdx = item2->GetAttributeCount() - 1; LogManager::instance().ItemLog( GetPlayerID(), item2->GetAttributeType(iAddedIdx), item2->GetAttributeValue(iAddedIdx), item->GetID(), "ADD_ATTRIBUTE_SUCCESS", buf, GetDesc()->GetHostName(), item->GetOriginalVnum()); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼º Ãß°¡¿¡ ½ÇÆĞÇÏ¿´½À´Ï´Ù.")); LogManager::instance().ItemLog(this, item, "ADD_ATTRIBUTE_FAIL", buf); } item->SetCount(item->GetCount() - 1); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õÀÌ»ó ÀÌ ¾ÆÀÌÅÛÀ» ÀÌ¿ëÇÏ¿© ¼Ó¼ºÀ» Ãß°¡ÇÒ ¼ö ¾ø½À´Ï´Ù.")); } break; case USE_ADD_ATTRIBUTE2 : if (item2->GetAttributeSetIndex() == -1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (item2->GetAttributeCount() == 4) { char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); if (number(1, 100) <= aiItemAttributeAddPercent[item2->GetAttributeCount()]) { item2->AddAttribute(); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼º Ãß°¡¿¡ ¼º°øÇÏ¿´½À´Ï´Ù.")); int iAddedIdx = item2->GetAttributeCount() - 1; LogManager::instance().ItemLog( GetPlayerID(), item2->GetAttributeType(iAddedIdx), item2->GetAttributeValue(iAddedIdx), item->GetID(), "ADD_ATTRIBUTE2_SUCCESS", buf, GetDesc()->GetHostName(), item->GetOriginalVnum()); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼Ó¼º Ãß°¡¿¡ ½ÇÆĞÇÏ¿´½À´Ï´Ù.")); LogManager::instance().ItemLog(this, item, "ADD_ATTRIBUTE2_FAIL", buf); } item->SetCount(item->GetCount() - 1); } else if (item2->GetAttributeCount() == 5) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´õ ÀÌ»ó ÀÌ ¾ÆÀÌÅÛÀ» ÀÌ¿ëÇÏ¿© ¼Ó¼ºÀ» Ãß°¡ÇÒ ¼ö ¾ø½À´Ï´Ù.")); } else if (item2->GetAttributeCount() < 4) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸ÕÀú Àç°¡ºñ¼­¸¦ ÀÌ¿ëÇÏ¿© ¼Ó¼ºÀ» Ãß°¡½ÃÄÑ ÁÖ¼¼¿ä.")); } else { // wtf ?! sys_err("ADD_ATTRIBUTE2 : Item has wrong AttributeCount(%d)", item2->GetAttributeCount()); } break; case USE_ADD_ACCESSORY_SOCKET: { char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); if (item2->IsAccessoryForSocket()) { if (item2->GetAccessorySocketMaxGrade() < ITEM_ACCESSORY_SOCKET_MAX_NUM) { #ifdef ENABLE_ADDSTONE_FAILURE if (number(1, 100) <= 50) #else if (1) #endif { item2->SetAccessorySocketMaxGrade(item2->GetAccessorySocketMaxGrade() + 1); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÄÏÀÌ ¼º°øÀûÀ¸·Î Ãß°¡µÇ¾ú½À´Ï´Ù.")); LogManager::instance().ItemLog(this, item, "ADD_SOCKET_SUCCESS", buf); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÄÏ Ãß°¡¿¡ ½ÇÆĞÇÏ¿´½À´Ï´Ù.")); LogManager::instance().ItemLog(this, item, "ADD_SOCKET_FAIL", buf); } item->SetCount(item->GetCount() - 1); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾×¼¼¼­¸®¿¡´Â ´õÀÌ»ó ¼ÒÄÏÀ» Ãß°¡ÇÒ °ø°£ÀÌ ¾ø½À´Ï´Ù.")); } } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀ¸·Î ¼ÒÄÏÀ» Ãß°¡ÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); } } break; case USE_PUT_INTO_BELT_SOCKET: case USE_PUT_INTO_ACCESSORY_SOCKET: if (item2->IsAccessoryForSocket() && item->CanPutInto(item2)) { char buf[21]; snprintf(buf, sizeof(buf), "%u", item2->GetID()); if (item2->GetAccessorySocketGrade() < item2->GetAccessorySocketMaxGrade()) { if (number(1, 100) <= aiAccessorySocketPutPct[item2->GetAccessorySocketGrade()]) { item2->SetAccessorySocketGrade(item2->GetAccessorySocketGrade() + 1); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀåÂø¿¡ ¼º°øÇÏ¿´½À´Ï´Ù.")); LogManager::instance().ItemLog(this, item, "PUT_SOCKET_SUCCESS", buf); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀåÂø¿¡ ½ÇÆĞÇÏ¿´½À´Ï´Ù.")); LogManager::instance().ItemLog(this, item, "PUT_SOCKET_FAIL", buf); } item->SetCount(item->GetCount() - 1); } else { if (item2->GetAccessorySocketMaxGrade() == 0) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸ÕÀú ´ÙÀ̾Ƹóµå·Î ¾Ç¼¼¼­¸®¿¡ ¼ÒÄÏÀ» Ãß°¡ÇؾßÇÕ´Ï´Ù.")); else if (item2->GetAccessorySocketMaxGrade() < ITEM_ACCESSORY_SOCKET_MAX_NUM) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾×¼¼¼­¸®¿¡´Â ´õÀÌ»ó ÀåÂøÇÒ ¼ÒÄÏÀÌ ¾ø½À´Ï´Ù.")); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ÙÀ̾Ƹóµå·Î ¼ÒÄÏÀ» Ãß°¡ÇؾßÇÕ´Ï´Ù.")); } else ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾×¼¼¼­¸®¿¡´Â ´õÀÌ»ó º¸¼®À» ÀåÂøÇÒ ¼ö ¾ø½À´Ï´Ù.")); } } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀ» ÀåÂøÇÒ ¼ö ¾ø½À´Ï´Ù.")); } break; } if (item2->IsEquipped()) { BuffOnAttr_AddBuffsFromItem(item2); } } break; // END_OF_ACCESSORY_REFINE & END_OF_ADD_ATTRIBUTES & END_OF_CHANGE_ATTRIBUTES case USE_BAIT: { if (m_pkFishingEvent) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³¬½Ã Áß¿¡ ¹Ì³¢¸¦ °¥¾Æ³¢¿ï ¼ö ¾ø½À´Ï´Ù.")); return false; } LPITEM weapon = GetWear(WEAR_WEAPON); if (!weapon || weapon->GetType() != ITEM_ROD) return false; if (weapon->GetSocket(2)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì ²ÈÇôÀÖ´ø ¹Ì³¢¸¦ »©°í %s¸¦ ³¢¿ó´Ï´Ù."), item->GetName()); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³¬½Ã´ë¿¡ %s¸¦ ¹Ì³¢·Î ³¢¿ó´Ï´Ù."), item->GetName()); } weapon->SetSocket(2, item->GetValue(0)); item->SetCount(item->GetCount() - 1); } break; case USE_MOVE: case USE_TREASURE_BOX: case USE_MONEYBAG: break; case USE_AFFECT : { if (FindAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].bPointType)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù.")); } else { // PC_BANG_ITEM_ADD if (item->IsPCBangItem() == true) { if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº PC¹æ¿¡¼­¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); return false; } } // END_PC_BANG_ITEM_ADD AddAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false); item->SetCount(item->GetCount() - 1); } } break; case USE_CREATE_STONE: AutoGiveItem(number(28000, 28013)); item->SetCount(item->GetCount() - 1); break; case USE_RECIPE : { LPITEM pSource1 = FindSpecifyItem(item->GetValue(1)); DWORD dwSourceCount1 = item->GetValue(2); LPITEM pSource2 = FindSpecifyItem(item->GetValue(3)); DWORD dwSourceCount2 = item->GetValue(4); if (dwSourceCount1 != 0) { if (pSource1 == NULL) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹°¾à Á¶ÇÕÀ» À§ÇÑ Àç·á°¡ ºÎÁ·ÇÕ´Ï´Ù.")); return false; } } if (dwSourceCount2 != 0) { if (pSource2 == NULL) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹°¾à Á¶ÇÕÀ» À§ÇÑ Àç·á°¡ ºÎÁ·ÇÕ´Ï´Ù.")); return false; } } if (pSource1 != NULL) { if (pSource1->GetCount() < dwSourceCount1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Àç·á(%s)°¡ ºÎÁ·ÇÕ´Ï´Ù."), pSource1->GetName()); return false; } pSource1->SetCount(pSource1->GetCount() - dwSourceCount1); } if (pSource2 != NULL) { if (pSource2->GetCount() < dwSourceCount2) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Àç·á(%s)°¡ ºÎÁ·ÇÕ´Ï´Ù."), pSource2->GetName()); return false; } pSource2->SetCount(pSource2->GetCount() - dwSourceCount2); } LPITEM pBottle = FindSpecifyItem(50901); if (!pBottle || pBottle->GetCount() < 1) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ºó º´ÀÌ ¸ğÀÚ¸¨´Ï´Ù.")); return false; } pBottle->SetCount(pBottle->GetCount() - 1); if (number(1, 100) > item->GetValue(5)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹°¾à Á¦Á¶¿¡ ½ÇÆĞÇß½À´Ï´Ù.")); return false; } AutoGiveItem(item->GetValue(0)); } break; } } break; case ITEM_METIN: { LPITEM item2; if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell))) return false; if (item2->IsExchanging() || item2->IsEquipped()) // @fixme114 return false; if (item2->GetType() == ITEM_PICK) return false; if (item2->GetType() == ITEM_ROD) return false; int i; for (i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) { DWORD dwVnum; if ((dwVnum = item2->GetSocket(i)) <= 2) continue; TItemTable * p = ITEM_MANAGER::instance().GetTable(dwVnum); if (!p) continue; if (item->GetValue(5) == p->alValues[5]) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°°Àº Á¾·ùÀÇ ¸ŞÆ¾¼®Àº ¿©·¯°³ ºÎÂøÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } } if (item2->GetType() == ITEM_ARMOR) { if (!IS_SET(item->GetWearFlag(), WEARABLE_BODY) || !IS_SET(item2->GetWearFlag(), WEARABLE_BODY)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¸ŞÆ¾¼®Àº Àåºñ¿¡ ºÎÂøÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } } else if (item2->GetType() == ITEM_WEAPON) { if (!IS_SET(item->GetWearFlag(), WEARABLE_WEAPON)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¸ŞÆ¾¼®Àº ¹«±â¿¡ ºÎÂøÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ºÎÂøÇÒ ¼ö ÀÖ´Â ½½·ÔÀÌ ¾ø½À´Ï´Ù.")); return false; } for (i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) if (item2->GetSocket(i) >= 1 && item2->GetSocket(i) <= 2 && item2->GetSocket(i) >= item->GetValue(2)) { #ifdef ENABLE_ADDSTONE_FAILURE if (number(1, 100) <= 30) #else if (1) #endif { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸ŞÆ¾¼® ºÎÂø¿¡ ¼º°øÇÏ¿´½À´Ï´Ù.")); item2->SetSocket(i, item->GetVnum()); } else { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸ŞÆ¾¼® ºÎÂø¿¡ ½ÇÆĞÇÏ¿´½À´Ï´Ù.")); item2->SetSocket(i, ITEM_BROKEN_METIN_VNUM); } LogManager::instance().ItemLog(this, item2, "SOCKET", item->GetName()); #ifdef ENABLE_STACK_STONE if (item->IsStackable()) { item->SetCount(item->GetCount() - 1); } else { ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (METIN)"); } #else ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (METIN)"); #endif break; } if (i == ITEM_SOCKET_MAX_NUM) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ºÎÂøÇÒ ¼ö ÀÖ´Â ½½·ÔÀÌ ¾ø½À´Ï´Ù.")); } break; case ITEM_AUTOUSE: case ITEM_MATERIAL: case ITEM_SPECIAL: case ITEM_TOOL: case ITEM_LOTTERY: break; case ITEM_TOTEM: { if (!item->IsEquipped()) EquipItem(item); } break; case ITEM_BLEND: sys_log(0,"ITEM_BLEND!!"); if (Blend_Item_find(item->GetVnum())) { int affect_type = AFFECT_BLEND; int apply_type = aApplyInfo[item->GetSocket(0)].bPointType; int apply_value = item->GetSocket(1); int apply_duration = item->GetSocket(2); if (FindAffect(affect_type, apply_type)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù.")); } else { if (FindAffect(AFFECT_EXP_BONUS_EURO_FREE, POINT_RESIST_MAGIC)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù.")); } else { AddAffect(affect_type, apply_type, apply_value, 0, apply_duration, 0, false); item->SetCount(item->GetCount() - 1); } } } break; case ITEM_EXTRACT: { LPITEM pDestItem = GetItem(DestCell); if (NULL == pDestItem) { return false; } switch (item->GetSubType()) { case EXTRACT_DRAGON_SOUL: if (pDestItem->IsDragonSoul()) { return DSManager::instance().PullOut(this, NPOS, pDestItem, item); } return false; case EXTRACT_DRAGON_HEART: if (pDestItem->IsDragonSoul()) { return DSManager::instance().ExtractDragonHeart(this, pDestItem, item); } return false; default: return false; } } break; case ITEM_GACHA: { DWORD dwBoxVnum = item->GetVnum(); std::vector <DWORD> dwVnums; std::vector <DWORD> dwCounts; std::vector <LPITEM> item_gets(0); int count = 0; if (GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count)) { if(item->GetSocket(0) > 1) item->SetSocket(0, item->GetSocket(0) - 1); else ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (ITEM_GACHA)"); } } break; case ITEM_NONE: sys_err("Item type NONE %s", item->GetName()); break; default: sys_log(0, "UseItemEx: Unknown type %s %d", item->GetName(), item->GetType()); return false; } return true; } int g_nPortalLimitTime = 10; bool CHARACTER::UseItem(TItemPos Cell, TItemPos DestCell) { WORD wCell = Cell.cell; BYTE window_type = Cell.window_type; //WORD wDestCell = DestCell.cell; //BYTE bDestInven = DestCell.window_type; LPITEM item; if (!CanHandleItem()) return false; if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell))) return false; sys_log(0, "%s: USE_ITEM %s (inven %d, cell: %d)", GetName(), item->GetName(), window_type, wCell); if (item->IsExchanging()) return false; if (!item->CanUsedBy(this)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±ºÁ÷ÀÌ ¸ÂÁö¾Ê¾Æ ÀÌ ¾ÆÀÌÅÛÀ» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (IsStun()) return false; if (false == FN_check_item_sex(this, item)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ºº°ÀÌ ¸ÂÁö¾Ê¾Æ ÀÌ ¾ÆÀÌÅÛÀ» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } //PREVENT_TRADE_WINDOW if (IS_SUMMON_ITEM(item->GetVnum())) { if (false == IS_SUMMONABLE_ZONE(GetMapIndex())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.")); return false; } if (CThreeWayWar::instance().IsThreeWayWarMapIndex(GetMapIndex())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("»ï°Å¸® ÀüÅõ Âü°¡Áß¿¡´Â ±ÍȯºÎ,±Íȯ±â¾ïºÎ¸¦ »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.")); return false; } int iPulse = thecore_pulse(); if (iPulse - GetSafeboxLoadTime() < PASSES_PER_SEC(g_nPortalLimitTime)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("â°í¸¦ ¿¬ÈÄ %dÃÊ À̳»¿¡´Â ±ÍȯºÎ,±Íȯ±â¾ïºÎ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."), g_nPortalLimitTime); if (test_server) ChatPacket(CHAT_TYPE_INFO, "[TestOnly]Pulse %d LoadTime %d PASS %d", iPulse, GetSafeboxLoadTime(), PASSES_PER_SEC(g_nPortalLimitTime)); return false; } if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡Ã¢,â°í µîÀ» ¿¬ »óÅ¿¡¼­´Â ±ÍȯºÎ,±Íȯ±â¾ïºÎ ¸¦ »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.")); return false; } //PREVENT_REFINE_HACK { if (iPulse - GetRefineTime() < PASSES_PER_SEC(g_nPortalLimitTime)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ °³·®ÈÄ %dÃÊ À̳»¿¡´Â ±ÍȯºÎ,±Íȯ±â¾ïºÎ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."), g_nPortalLimitTime); return false; } } //END_PREVENT_REFINE_HACK //PREVENT_ITEM_COPY { if (iPulse - GetMyShopTime() < PASSES_PER_SEC(g_nPortalLimitTime)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°³ÀλóÁ¡ »ç¿ëÈÄ %dÃÊ À̳»¿¡´Â ±ÍȯºÎ,±Íȯ±â¾ïºÎ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."), g_nPortalLimitTime); return false; } } //END_PREVENT_ITEM_COPY if (item->GetVnum() != 70302) { PIXEL_POSITION posWarp; int x = 0; int y = 0; double nDist = 0; const double nDistant = 5000.0; if (item->GetVnum() == 22010) { x = item->GetSocket(0) - GetX(); y = item->GetSocket(1) - GetY(); } else if (item->GetVnum() == 22000) { SECTREE_MANAGER::instance().GetRecallPositionByEmpire(GetMapIndex(), GetEmpire(), posWarp); if (item->GetSocket(0) == 0) { x = posWarp.x - GetX(); y = posWarp.y - GetY(); } else { x = item->GetSocket(0) - GetX(); y = item->GetSocket(1) - GetY(); } } nDist = sqrt(pow((float)x,2) + pow((float)y,2)); if (nDistant > nDist) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À̵¿ µÇ¾îÁú À§Ä¡¿Í ³Ê¹« °¡±î¿ö ±ÍȯºÎ¸¦ »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.")); if (test_server) ChatPacket(CHAT_TYPE_INFO, "PossibleDistant %f nNowDist %f", nDistant,nDist); return false; } } //PREVENT_PORTAL_AFTER_EXCHANGE if (iPulse - GetExchangeTime() < PASSES_PER_SEC(g_nPortalLimitTime)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡ ÈÄ %dÃÊ À̳»¿¡´Â ±ÍȯºÎ,±Íȯ±â¾ïºÎµîÀ» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù."), g_nPortalLimitTime); return false; } //END_PREVENT_PORTAL_AFTER_EXCHANGE } if ((item->GetVnum() == 50200) || (item->GetVnum() == 71049)) { if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°Å·¡Ã¢,â°í µîÀ» ¿¬ »óÅ¿¡¼­´Â º¸µû¸®,ºñ´Üº¸µû¸®¸¦ »ç¿ëÇÒ¼ö ¾ø½À´Ï´Ù.")); return false; } } //END_PREVENT_TRADE_WINDOW // @fixme150 BEGIN if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot use this item if you're using quests")); return false; } // @fixme150 END if (IS_SET(item->GetFlag(), ITEM_FLAG_LOG)) { DWORD vid = item->GetVID(); DWORD oldCount = item->GetCount(); DWORD vnum = item->GetVnum(); char hint[ITEM_NAME_MAX_LEN + 32 + 1]; int len = snprintf(hint, sizeof(hint) - 32, "%s", item->GetName()); if (len < 0 || len >= (int) sizeof(hint) - 32) len = (sizeof(hint) - 32) - 1; bool ret = UseItemEx(item, DestCell); if (NULL == ITEM_MANAGER::instance().FindByVID(vid)) { LogManager::instance().ItemLog(this, vid, vnum, "REMOVE", hint); } else if (oldCount != item->GetCount()) { snprintf(hint + len, sizeof(hint) - len, " %u", oldCount - 1); LogManager::instance().ItemLog(this, vid, vnum, "USE_ITEM", hint); } return (ret); } else return UseItemEx(item, DestCell); } bool CHARACTER::DropItem(TItemPos Cell, BYTE bCount) { LPITEM item = NULL; if (!CanHandleItem()) { if (NULL != DragonSoul_RefineWindow_GetOpener()) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­Ã¢À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù.")); return false; } #ifdef ENABLE_NEWSTUFF if (0 != g_ItemDropTimeLimitValue) { if (get_dword_time() < m_dwLastItemDropTime+g_ItemDropTimeLimitValue) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ °ñµå¸¦ ¹ö¸± ¼ö ¾ø½À´Ï´Ù.")); return false; } } m_dwLastItemDropTime = get_dword_time(); #endif if (IsDead()) return false; if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell))) return false; if (item->IsExchanging()) return false; if (true == item->isLocked()) return false; if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true) return false; if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_DROP | ITEM_ANTIFLAG_GIVE)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹ö¸± ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); return false; } if (bCount == 0 || bCount > item->GetCount()) bCount = item->GetCount(); SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, 255); LPITEM pkItemToDrop; if (bCount == item->GetCount()) { item->RemoveFromCharacter(); pkItemToDrop = item; } else { if (bCount == 0) { if (test_server) sys_log(0, "[DROP_ITEM] drop item count == 0"); return false; } item->SetCount(item->GetCount() - bCount); ITEM_MANAGER::instance().FlushDelayedSave(item); pkItemToDrop = ITEM_MANAGER::instance().CreateItem(item->GetVnum(), bCount); // copy item socket -- by mhh FN_copy_item_socket(pkItemToDrop, item); char szBuf[51 + 1]; snprintf(szBuf, sizeof(szBuf), "%u %u", pkItemToDrop->GetID(), pkItemToDrop->GetCount()); LogManager::instance().ItemLog(this, item, "ITEM_SPLIT", szBuf); } PIXEL_POSITION pxPos = GetXYZ(); if (pkItemToDrop->AddToGround(GetMapIndex(), pxPos)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¶³¾îÁø ¾ÆÀÌÅÛÀº 3ºĞ ÈÄ »ç¶óÁı´Ï´Ù.")); #ifdef ENABLE_NEWSTUFF pkItemToDrop->StartDestroyEvent(g_aiItemDestroyTime[ITEM_DESTROY_TIME_DROPITEM]); #else pkItemToDrop->StartDestroyEvent(); #endif ITEM_MANAGER::instance().FlushDelayedSave(pkItemToDrop); char szHint[32 + 1]; snprintf(szHint, sizeof(szHint), "%s %u %u", pkItemToDrop->GetName(), pkItemToDrop->GetCount(), pkItemToDrop->GetOriginalVnum()); LogManager::instance().ItemLog(this, pkItemToDrop, "DROP", szHint); //Motion(MOTION_PICKUP); } return true; } #ifdef ENABLE_CHEQUE_SYSTEM bool CHARACTER::DropCheque(int cheque) { //return false; // If you don't want to be able to drop won if (cheque <= 0 || cheque > GetCheque()) return false; if (cheque >= CHEQUE_MAX) return false; if (!CanHandleItem()) return false; LPITEM item = ITEM_MANAGER::instance().CreateItem(80020, cheque); if (item) { PIXEL_POSITION pos = GetXYZ(); if (item->AddToGround(GetMapIndex(), pos)) { PointChange(POINT_CHEQUE, -cheque, true); item->StartDestroyEvent(60); } Save(); return true; } return false; } #endif #ifdef WJ_NEW_DROP_DIALOG bool CHARACTER::DestroyItem(TItemPos Cell) { LPITEM item = NULL; if (!CanHandleItem()) { if (NULL != DragonSoul_RefineWindow_GetOpener()) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("??A¡ËA¡í ¢¯¡ş ¡íoAA¢¯¢®?¢¥A ¨ú¨¡AIAUA¡í ¢¯A¡¾©¡ ¨ùo ¨ú©ª¨öA¢¥I¢¥U.")); return false; } if (IsDead()) return false; if (!IsValidItemPosition(Cell) || !(item = GetItem(Cell))) return false; if (item->IsExchanging()) return false; if (true == item->isLocked()) return false; if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true) return false; if (item->GetCount() <= 0) return false; SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, 255); ITEM_MANAGER::instance().RemoveItem(item); return true; } #endif bool CHARACTER::DropGold(int gold) { if (gold <= 0 || gold > GetGold()) return false; if (!CanHandleItem()) return false; if (0 != g_GoldDropTimeLimitValue) { if (get_dword_time() < m_dwLastGoldDropTime+g_GoldDropTimeLimitValue) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ °ñµå¸¦ ¹ö¸± ¼ö ¾ø½À´Ï´Ù.")); return false; } } m_dwLastGoldDropTime = get_dword_time(); LPITEM item = ITEM_MANAGER::instance().CreateItem(1, gold); if (item) { PIXEL_POSITION pos = GetXYZ(); if (item->AddToGround(GetMapIndex(), pos)) { //Motion(MOTION_PICKUP); PointChange(POINT_GOLD, -gold, true); if (gold > 1000) LogManager::instance().CharLog(this, gold, "DROP_GOLD", ""); #ifdef ENABLE_NEWSTUFF item->StartDestroyEvent(g_aiItemDestroyTime[ITEM_DESTROY_TIME_DROPGOLD]); #else item->StartDestroyEvent(); #endif ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¶³¾îÁø ¾ÆÀÌÅÛÀº %dºĞ ÈÄ »ç¶óÁı´Ï´Ù."), 150/60); } Save(); return true; } return false; } bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count) { #ifdef ENABLE_SPECIAL_STORAGE if (DestCell.window_type == INVENTORY && (Cell.window_type >= UPGRADE_INVENTORY && Cell.window_type <= VARIUS_INVENTORY)) { if (DestCell.cell > 4) { DWORD itemSlot = DestCell.cell - 5; LPITEM tmpItem = GetInventoryItem(itemSlot); if (DestCell.cell >= 10) { itemSlot = DestCell.cell - 10; if (GetInventoryItem(itemSlot) && GetInventoryItem(itemSlot)->GetSize() == 3) return false; } if (tmpItem) { if (tmpItem->GetSize() >= 2) return false; } } } #endif LPITEM item = NULL; if (!IsValidItemPosition(Cell)) return false; if (!(item = GetItem(Cell))) return false; if (item->IsExchanging()) return false; if (item->GetCount() < count) return false; if (INVENTORY == Cell.window_type && Cell.cell >= INVENTORY_MAX_NUM && IS_SET(item->GetFlag(), ITEM_FLAG_IRREMOVABLE)) return false; if (true == item->isLocked()) return false; if (!IsValidItemPosition(DestCell)) { return false; } if (!CanHandleItem()) { if (NULL != DragonSoul_RefineWindow_GetOpener()) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°­È­Ã¢À» ¿¬ »óÅ¿¡¼­´Â ¾ÆÀÌÅÛÀ» ¿Å±æ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (DestCell.IsBeltInventoryPosition() && false == CBeltInventoryHelper::CanMoveIntoBeltInventory(item)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº º§Æ® Àκ¥Å丮·Î ¿Å±æ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (Cell.IsEquipPosition()) { if (!CanUnequipNow(item)) return false; #ifdef ENABLE_WEAPON_COSTUME_SYSTEM int iWearCell = item->FindEquipCell(this); if (iWearCell == WEAR_WEAPON) { LPITEM costumeWeapon = GetWear(WEAR_COSTUME_WEAPON); if (costumeWeapon && !UnequipItem(costumeWeapon)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot unequip the costume weapon. Not enough space.")); return false; } if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell)) return UnequipItem(item); } #endif } if (DestCell.IsEquipPosition()) { if (GetItem(DestCell)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì Àåºñ¸¦ Âø¿ëÇÏ°í ÀÖ½À´Ï´Ù.")); return false; } EquipItem(item, DestCell.cell - INVENTORY_MAX_NUM); } else { if (item->IsDragonSoul()) { if (item->IsEquipped()) { return DSManager::instance().PullOut(this, DestCell, item); } else { if (DestCell.window_type != DRAGON_SOUL_INVENTORY) { return false; } if (!DSManager::instance().IsValidCellForThisItem(item, DestCell)) return false; } } else if (DRAGON_SOUL_INVENTORY == DestCell.window_type) return false; #ifdef ENABLE_SPECIAL_STORAGE switch (DestCell.window_type) { case UPGRADE_INVENTORY: case BOOK_INVENTORY: case STONE_INVENTORY: case CHEST_INVENTORY: case BONUS_INVENTORY: case VARIUS_INVENTORY: { char szTemp[256]; snprintf(szTemp, sizeof(szTemp), LC_TEXT(" x%d "), item->GetCount()); if (Cell.window_type != DestCell.window_type && Cell.window_type != INVENTORY) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The item %s%s is not allowed to be stored here."), item->GetName(), (item->GetCount() > 1 ? szTemp : " ")); return false; } else if (Cell.window_type == INVENTORY) { if (item->GetSpecialWindowType() != DestCell.window_type) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The item %s%s is not allowed to be stored here."), item->GetName(), (item->GetCount() > 1 ? szTemp : " ")); return false; } } else if (Cell.window_type >= UPGRADE_INVENTORY && Cell.window_type <= VARIUS_INVENTORY) { if (GetItem(DestCell) && GetItem(Cell) && GetItem(DestCell)->GetVnum() == GetItem(Cell)->GetVnum()) { if (DestCell.cell == Cell.cell) return false; } } } break; } #endif LPITEM item2; if ((item2 = GetItem(DestCell)) && item != item2 && item2->IsStackable() && !IS_SET(item2->GetAntiFlag(), ITEM_ANTIFLAG_STACK) && item2->GetVnum() == item->GetVnum()) { for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i) if (item2->GetSocket(i) != item->GetSocket(i)) return false; if (count == 0) count = item->GetCount(); sys_log(0, "%s: ITEM_STACK %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell, DestCell.window_type, DestCell.cell, count); count = MIN(g_bItemCountLimit - item2->GetCount(), count); item->SetCount(item->GetCount() - count); item2->SetCount(item2->GetCount() + count); return true; } if (!IsEmptyItemGrid(DestCell, item->GetSize(), (DestCell.window_type==Cell.window_type)?Cell.cell:-1)) return false; if (count == 0 || count >= item->GetCount() || !item->IsStackable() || IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { sys_log(0, "%s: ITEM_MOVE %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell, DestCell.window_type, DestCell.cell, count); item->RemoveFromCharacter(); #ifdef ENABLE_HIGHLIGHT_NEW_ITEM SetItem(DestCell, item, true); #else SetItem(DestCell, item); #endif if (INVENTORY == Cell.window_type && INVENTORY == DestCell.window_type) SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, DestCell.cell); } else if (count < item->GetCount()) { sys_log(0, "%s: ITEM_SPLIT %s (window: %d, cell : %d) -> (window:%d, cell %d) count %d", GetName(), item->GetName(), Cell.window_type, Cell.cell, DestCell.window_type, DestCell.cell, count); item->SetCount(item->GetCount() - count); LPITEM item2 = ITEM_MANAGER::instance().CreateItem(item->GetVnum(), count); // copy socket -- by mhh FN_copy_item_socket(item2, item); item2->AddToCharacter(this, DestCell); char szBuf[51+1]; snprintf(szBuf, sizeof(szBuf), "%u %u %u %u ", item2->GetID(), item2->GetCount(), item->GetCount(), item->GetCount() + item2->GetCount()); LogManager::instance().ItemLog(this, item, "ITEM_SPLIT", szBuf); } } return true; } namespace NPartyPickupDistribute { struct FFindOwnership { LPITEM item; LPCHARACTER owner; FFindOwnership(LPITEM item) : item(item), owner(NULL) { } void operator () (LPCHARACTER ch) { if (item->IsOwnership(ch)) owner = ch; } }; struct FCountNearMember { int total; int x, y; FCountNearMember(LPCHARACTER center ) : total(0), x(center->GetX()), y(center->GetY()) { } void operator () (LPCHARACTER ch) { if (DISTANCE_APPROX(ch->GetX() - x, ch->GetY() - y) <= PARTY_DEFAULT_RANGE) total += 1; } }; struct FMoneyDistributor { int total; LPCHARACTER c; int x, y; int iMoney; FMoneyDistributor(LPCHARACTER center, int iMoney) : total(0), c(center), x(center->GetX()), y(center->GetY()), iMoney(iMoney) { } void operator ()(LPCHARACTER ch) { if (ch!=c) if (DISTANCE_APPROX(ch->GetX() - x, ch->GetY() - y) <= PARTY_DEFAULT_RANGE) { ch->PointChange(POINT_GOLD, iMoney, true); if (iMoney > 1000) { LOG_LEVEL_CHECK(LOG_LEVEL_MAX, LogManager::instance().CharLog(ch, iMoney, "GET_GOLD", "")); } } } }; } #ifdef ENABLE_CHEQUE_SYSTEM void CHARACTER::GiveCheque(int iAmount) { if (iAmount <= 0) return; PointChange(POINT_CHEQUE, iAmount, true); } #endif void CHARACTER::GiveGold(int iAmount) { if (iAmount <= 0) return; sys_log(0, "GIVE_GOLD: %s %d", GetName(), iAmount); if (GetParty()) { LPPARTY pParty = GetParty(); DWORD dwTotal = iAmount; DWORD dwMyAmount = dwTotal; NPartyPickupDistribute::FCountNearMember funcCountNearMember(this); pParty->ForEachOnlineMember(funcCountNearMember); if (funcCountNearMember.total > 1) { DWORD dwShare = dwTotal / funcCountNearMember.total; dwMyAmount -= dwShare * (funcCountNearMember.total - 1); NPartyPickupDistribute::FMoneyDistributor funcMoneyDist(this, dwShare); pParty->ForEachOnlineMember(funcMoneyDist); } PointChange(POINT_GOLD, dwMyAmount, true); if (dwMyAmount > 1000) { LOG_LEVEL_CHECK(LOG_LEVEL_MAX, LogManager::instance().CharLog(this, dwMyAmount, "GET_GOLD", "")); } } else { PointChange(POINT_GOLD, iAmount, true); if (iAmount > 1000) { LOG_LEVEL_CHECK(LOG_LEVEL_MAX, LogManager::instance().CharLog(this, iAmount, "GET_GOLD", "")); } } } bool CHARACTER::PickupItem(DWORD dwVID) { LPITEM item = ITEM_MANAGER::instance().FindByVID(dwVID); if (IsObserverMode()) return false; if (!item || !item->GetSectree()) return false; if (item->DistanceValid(this)) { // @fixme150 BEGIN if (item->GetType() == ITEM_QUEST) { if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot pickup this item if you're using quests")); return false; } } // @fixme150 END if (item->IsOwnership(this)) { if (item->GetType() == ITEM_ELK) { GiveGold(item->GetCount()); item->RemoveFromGround(); M2_DESTROY_ITEM(item); Save(); } #ifdef ENABLE_CHEQUE_SYSTEM else if (item->GetType() == ITEM_CHEQUE) { if (item->GetCount() + GetCheque() > CHEQUE_MAX - 1) return false; GiveCheque(item->GetCount()); item->RemoveFromGround(); M2_DESTROY_ITEM(item); Save(); } #endif else { //NEW ADD #ifdef ENABLE_SPECIAL_STORAGE if (item->IsUpgradeItem() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { BYTE bCount = item->GetCount(); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { LPITEM item2 = GetUpgradeInventoryItem(i); if (!item2) continue; if (item2->GetVnum() == item->GetVnum()) { BYTE bCount2 = MIN(g_bItemCountLimit - item2->GetCount(), bCount); bCount -= bCount2; item2->SetCount(item2->GetCount() + bCount2); if (bCount == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ú¨¡AIAU E©ö¥ì©¡: %s"), item2->GetName()); M2_DESTROY_ITEM(item); return true; } } } item->SetCount(bCount); } else if (item->IsBook() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { BYTE bCount = item->GetCount(); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { LPITEM item2 = GetBookInventoryItem(i); if (!item2) continue; if (item2->GetVnum() == item->GetVnum() && item2->GetSocket(0) == item->GetSocket(0)) { BYTE bCount2 = MIN(g_bItemCountLimit - item2->GetCount(), bCount); bCount -= bCount2; item2->SetCount(item2->GetCount() + bCount2); if (bCount == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ú¨¡AIAU E©ö¥ì©¡: %s"), item2->GetName()); M2_DESTROY_ITEM(item); return true; } } } item->SetCount(bCount); } else if (item->IsStone() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { BYTE bCount = item->GetCount(); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { LPITEM item2 = GetStoneInventoryItem(i); if (!item2) continue; if (item2->GetVnum() == item->GetVnum()) { BYTE bCount2 = MIN(g_bItemCountLimit - item2->GetCount(), bCount); bCount -= bCount2; item2->SetCount(item2->GetCount() + bCount2); if (bCount == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ú¨¡AIAU E©ö¥ì©¡: %s"), item2->GetName()); M2_DESTROY_ITEM(item); return true; } } } item->SetCount(bCount); } else if (item->IsChest() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { BYTE bCount = item->GetCount(); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { LPITEM item2 = GetChestInventoryItem(i); if (!item2) continue; if (item2->GetVnum() == item->GetVnum()) { BYTE bCount2 = MIN(g_bItemCountLimit - item2->GetCount(), bCount); bCount -= bCount2; item2->SetCount(item2->GetCount() + bCount2); if (bCount == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ú¨¡AIAU E©ö¥ì©¡: %s"), item2->GetName()); M2_DESTROY_ITEM(item); return true; } } } item->SetCount(bCount); } else if (item->IsBonus() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { BYTE bCount = item->GetCount(); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { LPITEM item2 = GetBonusInventoryItem(i); if (!item2) continue; if (item2->GetVnum() == item->GetVnum()) { BYTE bCount2 = MIN(g_bItemCountLimit - item2->GetCount(), bCount); bCount -= bCount2; item2->SetCount(item2->GetCount() + bCount2); if (bCount == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ú¨¡AIAU E©ö¥ì©¡: %s"), item2->GetName()); M2_DESTROY_ITEM(item); return true; } } } item->SetCount(bCount); } else if (item->IsVarius() && item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { BYTE bCount = item->GetCount(); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { LPITEM item2 = GetVariusInventoryItem(i); if (!item2) continue; if (item2->GetVnum() == item->GetVnum()) { BYTE bCount2 = MIN(g_bItemCountLimit - item2->GetCount(), bCount); bCount -= bCount2; item2->SetCount(item2->GetCount() + bCount2); if (bCount == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ú¨¡AIAU E©ö¥ì©¡: %s"), item2->GetName()); M2_DESTROY_ITEM(item); return true; } } } item->SetCount(bCount); } #endif if (item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { BYTE bCount = item->GetCount(); for (int i = 0; i < INVENTORY_MAX_NUM; ++i) { LPITEM item2 = GetInventoryItem(i); if (!item2) continue; if (item2->GetVnum() == item->GetVnum()) { int j; for (j = 0; j < ITEM_SOCKET_MAX_NUM; ++j) if (item2->GetSocket(j) != item->GetSocket(j)) break; if (j != ITEM_SOCKET_MAX_NUM) continue; BYTE bCount2 = MIN(g_bItemCountLimit - item2->GetCount(), bCount); bCount -= bCount2; item2->SetCount(item2->GetCount() + bCount2); if (bCount == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item2->GetName()); M2_DESTROY_ITEM(item); if (item2->GetType() == ITEM_QUEST) quest::CQuestManager::instance().PickupItem (GetPlayerID(), item2); return true; } } } item->SetCount(bCount); } int iEmptyCell; if (item->IsDragonSoul()) { if ((iEmptyCell = GetEmptyDragonSoulInventory(item)) == -1) { sys_log(0, "No empty ds inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù.")); return false; } } #ifdef ENABLE_SPECIAL_STORAGE else if (item->IsSpecialStorageItem()) { if ((iEmptyCell = GetEmptySpecialStorageSlot(item)) == -1) { sys_log(0, "No empty ssu inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ùOAoCI¡Æi AO¢¥A ¨ú¨¡AIAUAI ©øE©ö¡ì ¢¬©ö¨öA¢¥I¢¥U.")); return false; } } #endif else { if ((iEmptyCell = GetEmptyInventory(item->GetSize())) == -1) { sys_log(0, "No empty inventory pid %u size %ud itemid %u", GetPlayerID(), item->GetSize(), item->GetID()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù.")); return false; } } item->RemoveFromGround(); if (item->IsDragonSoul()) item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell)); //check if is item to special window #ifdef ENABLE_SPECIAL_STORAGE else if (item->IsSpecialStorageItem()) item->AddToCharacter(this, TItemPos(item->GetSpecialWindowType(), iEmptyCell)); #endif else item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell)); char szHint[32+1]; snprintf(szHint, sizeof(szHint), "%s %u %u", item->GetName(), item->GetCount(), item->GetOriginalVnum()); LogManager::instance().ItemLog(this, item, "GET", szHint); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item->GetName()); if (item->GetType() == ITEM_QUEST) quest::CQuestManager::instance().PickupItem (GetPlayerID(), item); } //Motion(MOTION_PICKUP); return true; } else if (!IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_GIVE | ITEM_ANTIFLAG_DROP) && GetParty()) { NPartyPickupDistribute::FFindOwnership funcFindOwnership(item); GetParty()->ForEachOnlineMember(funcFindOwnership); LPCHARACTER owner = funcFindOwnership.owner; // @fixme115 if (!owner) return false; int iEmptyCell; if (item->IsDragonSoul()) { if (!(owner && (iEmptyCell = owner->GetEmptyDragonSoulInventory(item)) != -1)) { owner = this; if ((iEmptyCell = GetEmptyDragonSoulInventory(item)) == -1) { owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù.")); return false; } } } //check space #ifdef ENABLE_SPECIAL_STORAGE else if (item->IsSpecialStorageItem()) { if (!(owner && (iEmptyCell = owner->GetEmptySpecialStorageSlot(item)) != -1)) { owner = this; if ((iEmptyCell = GetEmptySpecialStorageSlot(item)) == -1) { owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ùOAoCI¡Æi AO¢¥A ¨ú¨¡AIAUAI ©øE©ö¡ì ¢¬©ö¨öA¢¥I¢¥U.")); return false; } } } #endif else { if (!(owner && (iEmptyCell = owner->GetEmptyInventory(item->GetSize())) != -1)) { owner = this; if ((iEmptyCell = GetEmptyInventory(item->GetSize())) == -1) { owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ÒÁöÇÏ°í ÀÖ´Â ¾ÆÀÌÅÛÀÌ ³Ê¹« ¸¹½À´Ï´Ù.")); return false; } } } item->RemoveFromGround(); if (item->IsDragonSoul()) item->AddToCharacter(owner, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell)); #ifdef ENABLE_SPECIAL_STORAGE else if (item->IsSpecialStorageItem()) item->AddToCharacter(this, TItemPos(item->GetSpecialWindowType(), iEmptyCell)); #endif else item->AddToCharacter(owner, TItemPos(INVENTORY, iEmptyCell)); char szHint[32+1]; snprintf(szHint, sizeof(szHint), "%s %u %u", item->GetName(), item->GetCount(), item->GetOriginalVnum()); LogManager::instance().ItemLog(owner, item, "GET", szHint); if (owner == this) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item->GetName()); else { owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s ´ÔÀ¸·ÎºÎÅÍ %s"), GetName(), item->GetName()); ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ Àü´Ş: %s ´Ô¿¡°Ô %s"), owner->GetName(), item->GetName()); } if (item->GetType() == ITEM_QUEST) quest::CQuestManager::instance().PickupItem (owner->GetPlayerID(), item); return true; } } return false; } bool CHARACTER::SwapItem(BYTE bCell, BYTE bDestCell) { if (!CanHandleItem()) return false; TItemPos srcCell(INVENTORY, bCell), destCell(INVENTORY, bDestCell); //if (bCell >= INVENTORY_MAX_NUM + WEAR_MAX_NUM || bDestCell >= INVENTORY_MAX_NUM + WEAR_MAX_NUM) if (srcCell.IsDragonSoulEquipPosition() || destCell.IsDragonSoulEquipPosition()) return false; if (bCell == bDestCell) return false; if (srcCell.IsEquipPosition() && destCell.IsEquipPosition()) return false; LPITEM item1, item2; if (srcCell.IsEquipPosition()) { item1 = GetInventoryItem(bDestCell); item2 = GetInventoryItem(bCell); } else { item1 = GetInventoryItem(bCell); item2 = GetInventoryItem(bDestCell); } if (!item1 || !item2) return false; if (item1 == item2) { sys_log(0, "[WARNING][WARNING][HACK USER!] : %s %d %d", m_stName.c_str(), bCell, bDestCell); return false; } if (!IsEmptyItemGrid(TItemPos (INVENTORY, item1->GetCell()), item2->GetSize(), item1->GetCell())) return false; if (TItemPos(EQUIPMENT, item2->GetCell()).IsEquipPosition()) { BYTE bEquipCell = item2->GetCell() - INVENTORY_MAX_NUM; BYTE bInvenCell = item1->GetCell(); if (item2->IsDragonSoul() || item2->GetType() == ITEM_BELT) // @fixme117 { if (false == CanUnequipNow(item2) || false == CanEquipNow(item1)) return false; } if (bEquipCell != item1->FindEquipCell(this)) return false; item2->RemoveFromCharacter(); if (item1->EquipTo(this, bEquipCell)) item2->AddToCharacter(this, TItemPos(INVENTORY, bInvenCell)); else sys_err("SwapItem cannot equip %s! item1 %s", item2->GetName(), item1->GetName()); } else { BYTE bCell1 = item1->GetCell(); BYTE bCell2 = item2->GetCell(); item1->RemoveFromCharacter(); item2->RemoveFromCharacter(); item1->AddToCharacter(this, TItemPos(INVENTORY, bCell2)); item2->AddToCharacter(this, TItemPos(INVENTORY, bCell1)); } return true; } bool CHARACTER::UnequipItem(LPITEM item) { #ifdef ENABLE_WEAPON_COSTUME_SYSTEM int iWearCell = item->FindEquipCell(this); if (iWearCell == WEAR_WEAPON) { LPITEM costumeWeapon = GetWear(WEAR_COSTUME_WEAPON); if (costumeWeapon && !UnequipItem(costumeWeapon)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot unequip the costume weapon. Not enough space.")); return false; } } #endif if (false == CanUnequipNow(item)) return false; int pos; if (item->IsDragonSoul()) pos = GetEmptyDragonSoulInventory(item); else pos = GetEmptyInventory(item->GetSize()); // HARD CODING if (item->GetVnum() == UNIQUE_ITEM_HIDE_ALIGNMENT_TITLE) ShowAlignment(true); item->RemoveFromCharacter(); if (item->IsDragonSoul()) { item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, pos)); } else item->AddToCharacter(this, TItemPos(INVENTORY, pos)); CheckMaximumPoints(); return true; } // // bool CHARACTER::EquipItem(LPITEM item, int iCandidateCell) { if (item->IsExchanging()) return false; if (false == item->IsEquipable()) return false; if (false == CanEquipNow(item)) return false; int iWearCell = item->FindEquipCell(this, iCandidateCell); if (iWearCell < 0) return false; if (iWearCell == WEAR_BODY && IsRiding() && (item->GetVnum() >= 11902 && item->GetVnum() <= 11911 && item->GetVnum() <= 11912)) //Damatl©¥klar { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¢¬¡íA¡í A¨¬ ¡íoAA¢¯¢®¨ù ¢¯©ö¨¬©öA¡í AOA¡í ¨ùo ¨ú©ª¨öA¢¥I¢¥U.")); return false; } if (iWearCell == WEAR_BODY && IsRiding() && (item->GetVnum() >= 11903 && item->GetVnum() <= 11913 && item->GetVnum() <= 11914)) //Gelinlikler { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¢¬¡íA¡í A¨¬ ¡íoAA¢¯¢®¨ù ¢¯©ö¨¬©öA¡í AOA¡í ¨ùo ¨ú©ª¨öA¢¥I¢¥U.")); return false; } if (iWearCell == WEAR_WEAPON && IsRiding() && (item->GetVnum() == 50201 && item->GetVnum() <= 50202)) //Buketler { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¢¬¡íA¡í A¨¬ ¡íoAA¢¯¢®¨ù ¢¯©ö¨¬©öA¡í AOA¡í ¨ùo ¨ú©ª¨öA¢¥I¢¥U.")); return false; } if (iWearCell == WEAR_BODY && IsRiding() && (item->GetVnum() >= 11901 && item->GetVnum() <= 11904)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»À» ź »óÅ¿¡¼­ ¿¹º¹À» ÀÔÀ» ¼ö ¾ø½À´Ï´Ù.")); return false; } if (iWearCell != WEAR_ARROW && IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µĞ°© Áß¿¡´Â Âø¿ëÁßÀÎ Àåºñ¸¦ º¯°æÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (FN_check_item_sex(this, item) == false) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¼ºº°ÀÌ ¸ÂÁö¾Ê¾Æ ÀÌ ¾ÆÀÌÅÛÀ» »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if(item->IsRideItem() && IsRiding()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì Å»°ÍÀ» ÀÌ¿ëÁßÀÔ´Ï´Ù.")); return false; } DWORD dwCurTime = get_dword_time(); if (iWearCell != WEAR_ARROW && (dwCurTime - GetLastAttackTime() <= 1500 || dwCurTime - m_dwLastSkillTime <= 1500)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°¡¸¸È÷ ÀÖÀ» ¶§¸¸ Âø¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.")); return false; } #ifdef ENABLE_WEAPON_COSTUME_SYSTEM if (iWearCell == WEAR_WEAPON) { if (item->GetType() == ITEM_WEAPON) { LPITEM costumeWeapon = GetWear(WEAR_COSTUME_WEAPON); if (costumeWeapon && costumeWeapon->GetValue(3) != item->GetSubType() && !UnequipItem(costumeWeapon)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot unequip the costume weapon. Not enough space.")); return false; } } else //fishrod/pickaxe { LPITEM costumeWeapon = GetWear(WEAR_COSTUME_WEAPON); if (costumeWeapon && !UnequipItem(costumeWeapon)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot unequip the costume weapon. Not enough space.")); return false; } } } else if (iWearCell == WEAR_COSTUME_WEAPON) { if (item->GetType() == ITEM_COSTUME && item->GetSubType() == COSTUME_WEAPON) { LPITEM pkWeapon = GetWear(WEAR_WEAPON); if (!pkWeapon || pkWeapon->GetType() != ITEM_WEAPON || item->GetValue(3) != pkWeapon->GetSubType()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot equip the costume weapon. Wrong equipped weapon.")); return false; } } } #endif if (item->IsDragonSoul()) { if(GetInventoryItem(INVENTORY_MAX_NUM + iWearCell)) { ChatPacket(CHAT_TYPE_INFO, "ÀÌ¹Ì °°Àº Á¾·ùÀÇ ¿ëÈ¥¼®À» Âø¿ëÇÏ°í ÀÖ½À´Ï´Ù."); return false; } if (!item->EquipTo(this, iWearCell)) { return false; } } else { if (GetWear(iWearCell) && !IS_SET(GetWear(iWearCell)->GetFlag(), ITEM_FLAG_IRREMOVABLE)) { if (item->GetWearFlag() == WEARABLE_ABILITY) return false; if (false == SwapItem(item->GetCell(), INVENTORY_MAX_NUM + iWearCell)) { return false; } } else { BYTE bOldCell = item->GetCell(); if (item->EquipTo(this, iWearCell)) { SyncQuickslot(QUICKSLOT_TYPE_ITEM, bOldCell, iWearCell); } } } if (true == item->IsEquipped()) { if (-1 != item->GetProto()->cLimitRealTimeFirstUseIndex) { if (0 == item->GetSocket(1)) { long duration = (0 != item->GetSocket(0)) ? item->GetSocket(0) : item->GetProto()->aLimits[(unsigned char)(item->GetProto()->cLimitRealTimeFirstUseIndex)].lValue; if (0 == duration) duration = 60 * 60 * 24 * 7; item->SetSocket(0, time(0) + duration); item->StartRealTimeExpireEvent(); } item->SetSocket(1, item->GetSocket(1) + 1); } if (item->GetVnum() == UNIQUE_ITEM_HIDE_ALIGNMENT_TITLE) ShowAlignment(false); const DWORD& dwVnum = item->GetVnum(); if (true == CItemVnumHelper::IsRamadanMoonRing(dwVnum)) { this->EffectPacket(SE_EQUIP_RAMADAN_RING); } else if (true == CItemVnumHelper::IsHalloweenCandy(dwVnum)) { this->EffectPacket(SE_EQUIP_HALLOWEEN_CANDY); } else if (true == CItemVnumHelper::IsHappinessRing(dwVnum)) { this->EffectPacket(SE_EQUIP_HAPPINESS_RING); } else if (true == CItemVnumHelper::IsLovePendant(dwVnum)) { this->EffectPacket(SE_EQUIP_LOVE_PENDANT); } // ITEM_UNIQUEÀÇ °æ¿ì, SpecialItemGroup¿¡ Á¤ÀǵǾî ÀÖ°í, (item->GetSIGVnum() != NULL) // else if (ITEM_UNIQUE == item->GetType() && 0 != item->GetSIGVnum()) { const CSpecialItemGroup* pGroup = ITEM_MANAGER::instance().GetSpecialItemGroup(item->GetSIGVnum()); if (NULL != pGroup) { const CSpecialAttrGroup* pAttrGroup = ITEM_MANAGER::instance().GetSpecialAttrGroup(pGroup->GetAttrVnum(item->GetVnum())); if (NULL != pAttrGroup) { const std::string& std = pAttrGroup->m_stEffectFileName; SpecificEffectPacket(std.c_str()); } } } #ifdef ENABLE_ACCE_SYSTEM else if ((item->GetType() == ITEM_COSTUME) && (item->GetSubType() == COSTUME_ACCE)) this->EffectPacket(SE_EFFECT_ACCE_EQUIP); #endif if (item->IsNewMountItem()) // @fixme152 { quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false); } } return true; } void CHARACTER::BuffOnAttr_AddBuffsFromItem(LPITEM pItem) { for (size_t i = 0; i < sizeof(g_aBuffOnAttrPoints)/sizeof(g_aBuffOnAttrPoints[0]); i++) { TMapBuffOnAttrs::iterator it = m_map_buff_on_attrs.find(g_aBuffOnAttrPoints[i]); if (it != m_map_buff_on_attrs.end()) { it->second->AddBuffFromItem(pItem); } } } void CHARACTER::BuffOnAttr_RemoveBuffsFromItem(LPITEM pItem) { for (size_t i = 0; i < sizeof(g_aBuffOnAttrPoints)/sizeof(g_aBuffOnAttrPoints[0]); i++) { TMapBuffOnAttrs::iterator it = m_map_buff_on_attrs.find(g_aBuffOnAttrPoints[i]); if (it != m_map_buff_on_attrs.end()) { it->second->RemoveBuffFromItem(pItem); } } } void CHARACTER::BuffOnAttr_ClearAll() { for (TMapBuffOnAttrs::iterator it = m_map_buff_on_attrs.begin(); it != m_map_buff_on_attrs.end(); it++) { CBuffOnAttributes* pBuff = it->second; if (pBuff) { pBuff->Initialize(); } } } void CHARACTER::BuffOnAttr_ValueChange(BYTE bType, BYTE bOldValue, BYTE bNewValue) { TMapBuffOnAttrs::iterator it = m_map_buff_on_attrs.find(bType); if (0 == bNewValue) { if (m_map_buff_on_attrs.end() == it) return; else it->second->Off(); } else if(0 == bOldValue) { CBuffOnAttributes* pBuff = NULL; if (m_map_buff_on_attrs.end() == it) { switch (bType) { case POINT_ENERGY: { #ifdef ENABLE_PENDANT static BYTE abSlot[] = { WEAR_BODY, WEAR_HEAD, WEAR_FOOTS, WEAR_WRIST, WEAR_WEAPON, WEAR_NECK, WEAR_EAR, WEAR_SHIELD, WEAR_PENDANT }; #else static BYTE abSlot[] = { WEAR_BODY, WEAR_HEAD, WEAR_FOOTS, WEAR_WRIST, WEAR_WEAPON, WEAR_NECK, WEAR_EAR, WEAR_SHIELD }; #endif static std::vector <BYTE> vec_slots (abSlot, abSlot + _countof(abSlot)); pBuff = M2_NEW CBuffOnAttributes(this, bType, &vec_slots); } break; case POINT_COSTUME_ATTR_BONUS: { static BYTE abSlot[] = { WEAR_COSTUME_BODY, WEAR_COSTUME_HAIR, #ifdef ENABLE_WEAPON_COSTUME_SYSTEM WEAR_COSTUME_WEAPON, #endif }; static std::vector <BYTE> vec_slots (abSlot, abSlot + _countof(abSlot)); pBuff = M2_NEW CBuffOnAttributes(this, bType, &vec_slots); } break; default: break; } m_map_buff_on_attrs.insert(TMapBuffOnAttrs::value_type(bType, pBuff)); } else pBuff = it->second; if (pBuff != NULL) pBuff->On(bNewValue); } else { assert (m_map_buff_on_attrs.end() != it); it->second->ChangeBuffValue(bNewValue); } } LPITEM CHARACTER::FindSpecifyItem(DWORD vnum) const { for (int i = 0; i < INVENTORY_MAX_NUM; ++i) if (GetInventoryItem(i) && GetInventoryItem(i)->GetVnum() == vnum) return GetInventoryItem(i); #ifdef ENABLE_SPECIAL_STORAGE for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (GetUpgradeInventoryItem(i) && GetUpgradeInventoryItem(i)->GetVnum() == vnum) return GetUpgradeInventoryItem(i); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (GetBookInventoryItem(i) && GetBookInventoryItem(i)->GetVnum() == vnum) return GetBookInventoryItem(i); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (GetStoneInventoryItem(i) && GetStoneInventoryItem(i)->GetVnum() == vnum) return GetStoneInventoryItem(i); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (GetChestInventoryItem(i) && GetChestInventoryItem(i)->GetVnum() == vnum) return GetChestInventoryItem(i); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (GetBonusInventoryItem(i) && GetBonusInventoryItem(i)->GetVnum() == vnum) return GetBonusInventoryItem(i); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) if (GetVariusInventoryItem(i) && GetVariusInventoryItem(i)->GetVnum() == vnum) return GetVariusInventoryItem(i); #endif return NULL; } LPITEM CHARACTER::FindItemByID(DWORD id) const { for (int i=0 ; i < INVENTORY_MAX_NUM ; ++i) { if (NULL != GetInventoryItem(i) && GetInventoryItem(i)->GetID() == id) return GetInventoryItem(i); } #ifdef ENABLE_SPECIAL_STORAGE for (int i=0 ; i < SPECIAL_INVENTORY_MAX_NUM ; ++i) { if (NULL != GetUpgradeInventoryItem(i) && GetUpgradeInventoryItem(i)->GetID() == id) return GetUpgradeInventoryItem(i); } for (int i=0 ; i < SPECIAL_INVENTORY_MAX_NUM ; ++i) { if (NULL != GetBookInventoryItem(i) && GetBookInventoryItem(i)->GetID() == id) return GetBookInventoryItem(i); } for (int i=0 ; i < SPECIAL_INVENTORY_MAX_NUM ; ++i) { if (NULL != GetStoneInventoryItem(i) && GetStoneInventoryItem(i)->GetID() == id) return GetStoneInventoryItem(i); } for (int i=0 ; i < SPECIAL_INVENTORY_MAX_NUM ; ++i) { if (NULL != GetChestInventoryItem(i) && GetChestInventoryItem(i)->GetID() == id) return GetChestInventoryItem(i); } for (int i=0 ; i < SPECIAL_INVENTORY_MAX_NUM ; ++i) { if (NULL != GetBonusInventoryItem(i) && GetBonusInventoryItem(i)->GetID() == id) return GetBonusInventoryItem(i); } for (int i=0 ; i < SPECIAL_INVENTORY_MAX_NUM ; ++i) { if (NULL != GetVariusInventoryItem(i) && GetVariusInventoryItem(i)->GetID() == id) return GetVariusInventoryItem(i); } #endif for (int i=BELT_INVENTORY_SLOT_START; i < BELT_INVENTORY_SLOT_END ; ++i) { if (NULL != GetInventoryItem(i) && GetInventoryItem(i)->GetID() == id) return GetInventoryItem(i); } return NULL; } #ifdef ENABLE_PENDANT int CHARACTER::CountSpecifyItem(DWORD vnum, int iExceptionCell) const #else int CHARACTER::CountSpecifyItem(DWORD vnum) const #endif { int count = 0; LPITEM item; for (int i = 0; i < INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif item = GetInventoryItem(i); if (NULL != item && item->GetVnum() == vnum) { if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID())) { continue; } else { count += item->GetCount(); } } } #ifdef ENABLE_SPECIAL_STORAGE for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif item = GetUpgradeInventoryItem(i); if (NULL != item && item->GetVnum() == vnum) { if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID())) continue; else count += item->GetCount(); } } for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif item = GetBookInventoryItem(i); if (NULL != item && item->GetVnum() == vnum) { if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID())) continue; else count += item->GetCount(); } } for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif item = GetStoneInventoryItem(i); if (NULL != item && item->GetVnum() == vnum) { if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID())) continue; else count += item->GetCount(); } } for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif item = GetChestInventoryItem(i); if (NULL != item && item->GetVnum() == vnum) { if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID())) continue; else count += item->GetCount(); } } for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif item = GetBonusInventoryItem(i); if (NULL != item && item->GetVnum() == vnum) { if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID())) continue; else count += item->GetCount(); } } for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif item = GetVariusInventoryItem(i); if (NULL != item && item->GetVnum() == vnum) { if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID())) continue; else count += item->GetCount(); } } #endif return count; } #ifdef ENABLE_PENDANT void CHARACTER::RemoveSpecifyItem(DWORD vnum, DWORD count, int iExceptionCell) #else void CHARACTER::RemoveSpecifyItem(DWORD vnum, DWORD count) #endif { if (0 == count) return; for (UINT i = 0; i < INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif if (NULL == GetInventoryItem(i)) continue; if (GetInventoryItem(i)->GetVnum() != vnum) continue; if(m_pkMyShop) { bool isItemSelling = m_pkMyShop->IsSellingItem(GetInventoryItem(i)->GetID()); if (isItemSelling) continue; } if (vnum >= 80003 && vnum <= 80007) LogManager::instance().GoldBarLog(GetPlayerID(), GetInventoryItem(i)->GetID(), QUEST, "RemoveSpecifyItem"); if (count >= GetInventoryItem(i)->GetCount()) { count -= GetInventoryItem(i)->GetCount(); GetInventoryItem(i)->SetCount(0); if (0 == count) return; } else { GetInventoryItem(i)->SetCount(GetInventoryItem(i)->GetCount() - count); return; } } #ifdef ENABLE_SPECIAL_STORAGE for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif if (NULL == GetUpgradeInventoryItem(i)) continue; if (GetUpgradeInventoryItem(i)->GetVnum() != vnum) continue; if(m_pkMyShop) { bool isItemSelling = m_pkMyShop->IsSellingItem(GetUpgradeInventoryItem(i)->GetID()); if (isItemSelling) continue; } if (count >= GetUpgradeInventoryItem(i)->GetCount()) { count -= GetUpgradeInventoryItem(i)->GetCount(); GetUpgradeInventoryItem(i)->SetCount(0); if (0 == count) return; } else { GetUpgradeInventoryItem(i)->SetCount(GetUpgradeInventoryItem(i)->GetCount() - count); return; } } for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif if (NULL == GetBookInventoryItem(i)) continue; if (GetBookInventoryItem(i)->GetVnum() != vnum) continue; if(m_pkMyShop) { bool isItemSelling = m_pkMyShop->IsSellingItem(GetBookInventoryItem(i)->GetID()); if (isItemSelling) continue; } if (count >= GetBookInventoryItem(i)->GetCount()) { count -= GetBookInventoryItem(i)->GetCount(); GetBookInventoryItem(i)->SetCount(0); if (0 == count) return; } else { GetBookInventoryItem(i)->SetCount(GetBookInventoryItem(i)->GetCount() - count); return; } } for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif if (NULL == GetStoneInventoryItem(i)) continue; if (GetStoneInventoryItem(i)->GetVnum() != vnum) continue; if(m_pkMyShop) { bool isItemSelling = m_pkMyShop->IsSellingItem(GetStoneInventoryItem(i)->GetID()); if (isItemSelling) continue; } if (count >= GetStoneInventoryItem(i)->GetCount()) { count -= GetStoneInventoryItem(i)->GetCount(); GetStoneInventoryItem(i)->SetCount(0); if (0 == count) return; } else { GetStoneInventoryItem(i)->SetCount(GetStoneInventoryItem(i)->GetCount() - count); return; } } for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif if (NULL == GetChestInventoryItem(i)) continue; if (GetChestInventoryItem(i)->GetVnum() != vnum) continue; if(m_pkMyShop) { bool isItemSelling = m_pkMyShop->IsSellingItem(GetChestInventoryItem(i)->GetID()); if (isItemSelling) continue; } if (count >= GetChestInventoryItem(i)->GetCount()) { count -= GetChestInventoryItem(i)->GetCount(); GetChestInventoryItem(i)->SetCount(0); if (0 == count) return; } else { GetChestInventoryItem(i)->SetCount(GetChestInventoryItem(i)->GetCount() - count); return; } } for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif if (NULL == GetBonusInventoryItem(i)) continue; if (GetBonusInventoryItem(i)->GetVnum() != vnum) continue; if(m_pkMyShop) { bool isItemSelling = m_pkMyShop->IsSellingItem(GetBonusInventoryItem(i)->GetID()); if (isItemSelling) continue; } if (count >= GetBonusInventoryItem(i)->GetCount()) { count -= GetBonusInventoryItem(i)->GetCount(); GetBonusInventoryItem(i)->SetCount(0); if (0 == count) return; } else { GetBonusInventoryItem(i)->SetCount(GetBonusInventoryItem(i)->GetCount() - count); return; } } for (UINT i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { #ifdef ENABLE_PENDANT if (i == iExceptionCell) continue; #endif if (NULL == GetVariusInventoryItem(i)) continue; if (GetVariusInventoryItem(i)->GetVnum() != vnum) continue; if(m_pkMyShop) { bool isItemSelling = m_pkMyShop->IsSellingItem(GetVariusInventoryItem(i)->GetID()); if (isItemSelling) continue; } if (count >= GetVariusInventoryItem(i)->GetCount()) { count -= GetVariusInventoryItem(i)->GetCount(); GetVariusInventoryItem(i)->SetCount(0); if (0 == count) return; } else { GetVariusInventoryItem(i)->SetCount(GetVariusInventoryItem(i)->GetCount() - count); return; } } #endif if (count) sys_log(0, "CHARACTER::RemoveSpecifyItem cannot remove enough item vnum %u, still remain %d", vnum, count); } int CHARACTER::CountSpecifyTypeItem(BYTE type) const { int count = 0; for (int i = 0; i < INVENTORY_MAX_NUM; ++i) { LPITEM pItem = GetInventoryItem(i); if (pItem != NULL && pItem->GetType() == type) { count += pItem->GetCount(); } } return count; } void CHARACTER::RemoveSpecifyTypeItem(BYTE type, DWORD count) { if (0 == count) return; for (UINT i = 0; i < INVENTORY_MAX_NUM; ++i) { if (NULL == GetInventoryItem(i)) continue; if (GetInventoryItem(i)->GetType() != type) continue; if(m_pkMyShop) { bool isItemSelling = m_pkMyShop->IsSellingItem(GetInventoryItem(i)->GetID()); if (isItemSelling) continue; } if (count >= GetInventoryItem(i)->GetCount()) { count -= GetInventoryItem(i)->GetCount(); GetInventoryItem(i)->SetCount(0); if (0 == count) return; } else { GetInventoryItem(i)->SetCount(GetInventoryItem(i)->GetCount() - count); return; } } } void CHARACTER::AutoGiveItem(LPITEM item, bool longOwnerShip) { if (NULL == item) { sys_err ("NULL point."); return; } if (item->GetOwner()) { sys_err ("item %d 's owner exists!",item->GetID()); return; } int cell; if (item->IsDragonSoul()) { cell = GetEmptyDragonSoulInventory(item); } #ifdef ENABLE_SPECIAL_STORAGE else if (item->IsSpecialStorageItem()) cell = GetEmptySpecialStorageSlot(item); #endif else { cell = GetEmptyInventory (item->GetSize()); } if (cell != -1) { if (item->IsDragonSoul()) item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, cell)); #ifdef ENABLE_SPECIAL_STORAGE else if (item->IsSpecialStorageItem()) item->AddToCharacter(this, TItemPos(item->GetSpecialWindowType(), cell)); #endif else item->AddToCharacter(this, TItemPos(INVENTORY, cell)); LogManager::instance().ItemLog(this, item, "SYSTEM", item->GetName()); if (item->GetType() == ITEM_USE && item->GetSubType() == USE_POTION) { TQuickslot * pSlot; if (GetQuickslot(0, &pSlot) && pSlot->type == QUICKSLOT_TYPE_NONE) { TQuickslot slot; slot.type = QUICKSLOT_TYPE_ITEM; slot.pos = cell; SetQuickslot(0, slot); } } } else { item->AddToGround (GetMapIndex(), GetXYZ()); #ifdef ENABLE_NEWSTUFF item->StartDestroyEvent(g_aiItemDestroyTime[ITEM_DESTROY_TIME_AUTOGIVE]); #else item->StartDestroyEvent(); #endif if (longOwnerShip) item->SetOwnership (this, 300); else item->SetOwnership (this, 60); LogManager::instance().ItemLog(this, item, "SYSTEM_DROP", item->GetName()); } } LPITEM CHARACTER::AutoGiveItem(DWORD dwItemVnum, BYTE bCount, int iRarePct, bool bMsg) { TItemTable * p = ITEM_MANAGER::instance().GetTable(dwItemVnum); if (!p) return NULL; DBManager::instance().SendMoneyLog(MONEY_LOG_DROP, dwItemVnum, bCount); if (p->dwFlags & ITEM_FLAG_STACKABLE && p->bType != ITEM_BLEND) { for (int i = 0; i < INVENTORY_MAX_NUM; ++i) { LPITEM item = GetInventoryItem(i); if (!item) continue; if (item->GetVnum() == dwItemVnum && FN_check_item_socket(item)) { if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT)) { if (bCount < p->alValues[1]) bCount = p->alValues[1]; } BYTE bCount2 = MIN(g_bItemCountLimit - item->GetCount(), bCount); bCount -= bCount2; item->SetCount(item->GetCount() + bCount2); if (bCount == 0) { if (bMsg) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item->GetName()); return item; } } } } LPITEM item = ITEM_MANAGER::instance().CreateItem(dwItemVnum, bCount, 0, true); if (!item) { sys_err("cannot create item by vnum %u (name: %s)", dwItemVnum, GetName()); return NULL; } if (item->GetType() == ITEM_BLEND) { for (int i=0; i < INVENTORY_MAX_NUM; i++) { LPITEM inv_item = GetInventoryItem(i); if (inv_item == NULL) continue; if (inv_item->GetType() == ITEM_BLEND) { if (inv_item->GetVnum() == item->GetVnum()) { if (inv_item->GetSocket(0) == item->GetSocket(0) && inv_item->GetSocket(1) == item->GetSocket(1) && inv_item->GetSocket(2) == item->GetSocket(2) && inv_item->GetCount() < g_bItemCountLimit) { inv_item->SetCount(inv_item->GetCount() + item->GetCount()); return inv_item; } } } } } #ifdef ENABLE_SPECIAL_STORAGE if (item->IsSpecialStorageItem() && p->dwFlags & ITEM_FLAG_STACKABLE && p->bType != ITEM_BLEND) { LPITEM olditem = item; if (!olditem) return NULL; for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { LPITEM item = GetSpecialStorageItem(i, olditem->GetSpecialWindowType()); if (!item) continue; if (item->GetVnum() == dwItemVnum && FN_check_item_socket(item)) { if (IS_SET(p->dwFlags, ITEM_FLAG_MAKECOUNT)) { if (bCount < p->alValues[1]) bCount = p->alValues[1]; } BYTE bCount2 = MIN(g_bItemCountLimit - item->GetCount(), bCount); bCount -= bCount2; item->SetCount(item->GetCount() + bCount2); if (bCount == 0) { if (bMsg) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¨ú¨¡AIAU E©ö¥ì©¡: %s"), item->GetName()); return item; } } } } #endif int iEmptyCell; if (item->IsDragonSoul()) { iEmptyCell = GetEmptyDragonSoulInventory(item); } #ifdef ENABLE_SPECIAL_STORAGE else if (item->GetSpecialWindowType()) iEmptyCell = GetEmptySpecialStorageSlot(item); #endif else iEmptyCell = GetEmptyInventory(item->GetSize()); if (iEmptyCell != -1) { if (bMsg) ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÀÌÅÛ È¹µæ: %s"), item->GetName()); if (item->IsDragonSoul()) item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell)); #ifdef ENABLE_SPECIAL_STORAGE else if (item->IsSpecialStorageItem()) { item->AddToCharacter(this, TItemPos(item->GetSpecialWindowType(), iEmptyCell)); } #endif else item->AddToCharacter(this, TItemPos(INVENTORY, iEmptyCell)); LogManager::instance().ItemLog(this, item, "SYSTEM", item->GetName()); if (item->GetType() == ITEM_USE && item->GetSubType() == USE_POTION) { TQuickslot * pSlot; if (GetQuickslot(0, &pSlot) && pSlot->type == QUICKSLOT_TYPE_NONE) { TQuickslot slot; slot.type = QUICKSLOT_TYPE_ITEM; slot.pos = iEmptyCell; SetQuickslot(0, slot); } } } else { item->AddToGround(GetMapIndex(), GetXYZ()); #ifdef ENABLE_NEWSTUFF item->StartDestroyEvent(g_aiItemDestroyTime[ITEM_DESTROY_TIME_AUTOGIVE]); #else item->StartDestroyEvent(); #endif if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_DROP)) item->SetOwnership(this, 300); else item->SetOwnership(this, 60); LogManager::instance().ItemLog(this, item, "SYSTEM_DROP", item->GetName()); } sys_log(0, "7: %d %d", dwItemVnum, bCount); return item; } bool CHARACTER::GiveItem(LPCHARACTER victim, TItemPos Cell) { if (!CanHandleItem()) return false; // @fixme150 BEGIN if (quest::CQuestManager::instance().GetPCForce(GetPlayerID())->IsRunning() == true) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot take this item if you're using quests")); return false; } // @fixme150 END LPITEM item = GetItem(Cell); if (item && !item->IsExchanging()) { if (victim->CanReceiveItem(this, item)) { victim->ReceiveItem(this, item); return true; } } return false; } bool CHARACTER::CanReceiveItem(LPCHARACTER from, LPITEM item) const { if (IsPC()) return false; // TOO_LONG_DISTANCE_EXCHANGE_BUG_FIX if (DISTANCE_APPROX(GetX() - from->GetX(), GetY() - from->GetY()) > 2000) return false; // END_OF_TOO_LONG_DISTANCE_EXCHANGE_BUG_FIX switch (GetRaceNum()) { case fishing::CAMPFIRE_MOB: if (item->GetType() == ITEM_FISH && (item->GetSubType() == FISH_ALIVE || item->GetSubType() == FISH_DEAD)) return true; break; case fishing::FISHER_MOB: if (item->GetType() == ITEM_ROD) return true; break; // BUILDING_NPC case BLACKSMITH_WEAPON_MOB: case DEVILTOWER_BLACKSMITH_WEAPON_MOB: if (item->GetType() == ITEM_WEAPON && item->GetRefinedVnum()) return true; else return false; break; case BLACKSMITH_ARMOR_MOB: case DEVILTOWER_BLACKSMITH_ARMOR_MOB: if (item->GetType() == ITEM_ARMOR && (item->GetSubType() == ARMOR_BODY || item->GetSubType() == ARMOR_SHIELD || item->GetSubType() == ARMOR_HEAD) && item->GetRefinedVnum()) return true; else return false; break; case BLACKSMITH_ACCESSORY_MOB: case DEVILTOWER_BLACKSMITH_ACCESSORY_MOB: if (item->GetType() == ITEM_ARMOR && !(item->GetSubType() == ARMOR_BODY || item->GetSubType() == ARMOR_SHIELD || item->GetSubType() == ARMOR_HEAD) && item->GetRefinedVnum()) return true; else return false; break; // END_OF_BUILDING_NPC case BLACKSMITH_MOB: if (item->GetRefinedVnum() && item->GetRefineSet() < 500) { return true; } else { return false; } case BLACKSMITH2_MOB: if (item->GetRefineSet() >= 500) { return true; } else { return false; } case ALCHEMIST_MOB: if (item->GetRefinedVnum()) return true; break; case 20101: case 20102: case 20103: if (item->GetVnum() == ITEM_REVIVE_HORSE_1) { if (!IsDead()) { from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á×Áö ¾ÊÀº ¸»¿¡°Ô ¼±Ãʸ¦ ¸ÔÀÏ ¼ö ¾ø½À´Ï´Ù.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_1) { if (IsDead()) { from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á×Àº ¸»¿¡°Ô »ç·á¸¦ ¸ÔÀÏ ¼ö ¾ø½À´Ï´Ù.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_2 || item->GetVnum() == ITEM_HORSE_FOOD_3) { return false; } break; case 20104: case 20105: case 20106: if (item->GetVnum() == ITEM_REVIVE_HORSE_2) { if (!IsDead()) { from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á×Áö ¾ÊÀº ¸»¿¡°Ô ¼±Ãʸ¦ ¸ÔÀÏ ¼ö ¾ø½À´Ï´Ù.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_2) { if (IsDead()) { from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á×Àº ¸»¿¡°Ô »ç·á¸¦ ¸ÔÀÏ ¼ö ¾ø½À´Ï´Ù.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_1 || item->GetVnum() == ITEM_HORSE_FOOD_3) { return false; } break; case 20107: case 20108: case 20109: if (item->GetVnum() == ITEM_REVIVE_HORSE_3) { if (!IsDead()) { from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á×Áö ¾ÊÀº ¸»¿¡°Ô ¼±Ãʸ¦ ¸ÔÀÏ ¼ö ¾ø½À´Ï´Ù.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_3) { if (IsDead()) { from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Á×Àº ¸»¿¡°Ô »ç·á¸¦ ¸ÔÀÏ ¼ö ¾ø½À´Ï´Ù.")); return false; } return true; } else if (item->GetVnum() == ITEM_HORSE_FOOD_1 || item->GetVnum() == ITEM_HORSE_FOOD_2) { return false; } break; } //if (IS_SET(item->GetFlag(), ITEM_FLAG_QUEST_GIVE)) { return true; } return false; } void CHARACTER::ReceiveItem(LPCHARACTER from, LPITEM item) { if (IsPC()) return; switch (GetRaceNum()) { case fishing::CAMPFIRE_MOB: if (item->GetType() == ITEM_FISH && (item->GetSubType() == FISH_ALIVE || item->GetSubType() == FISH_DEAD)) fishing::Grill(from, item); else { // TAKE_ITEM_BUG_FIX from->SetQuestNPCID(GetVID()); // END_OF_TAKE_ITEM_BUG_FIX quest::CQuestManager::instance().TakeItem(from->GetPlayerID(), GetRaceNum(), item); } break; // DEVILTOWER_NPC case DEVILTOWER_BLACKSMITH_WEAPON_MOB: case DEVILTOWER_BLACKSMITH_ARMOR_MOB: case DEVILTOWER_BLACKSMITH_ACCESSORY_MOB: if (item->GetRefinedVnum() != 0 && item->GetRefineSet() != 0 && item->GetRefineSet() < 500) { from->SetRefineNPC(this); from->RefineInformation(item->GetCell(), REFINE_TYPE_MONEY_ONLY); } else { from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); } break; // END_OF_DEVILTOWER_NPC case BLACKSMITH_MOB: case BLACKSMITH2_MOB: case BLACKSMITH_WEAPON_MOB: case BLACKSMITH_ARMOR_MOB: case BLACKSMITH_ACCESSORY_MOB: if (item->GetRefinedVnum()) { from->SetRefineNPC(this); from->RefineInformation(item->GetCell(), REFINE_TYPE_NORMAL); } else { from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ ¾ÆÀÌÅÛÀº °³·®ÇÒ ¼ö ¾ø½À´Ï´Ù.")); } break; case 20101: case 20102: case 20103: case 20104: case 20105: case 20106: case 20107: case 20108: case 20109: if (item->GetVnum() == ITEM_REVIVE_HORSE_1 || item->GetVnum() == ITEM_REVIVE_HORSE_2 || item->GetVnum() == ITEM_REVIVE_HORSE_3) { from->ReviveHorse(); item->SetCount(item->GetCount()-1); from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»¿¡°Ô ¼±Ãʸ¦ ÁÖ¾ú½À´Ï´Ù.")); } else if (item->GetVnum() == ITEM_HORSE_FOOD_1 || item->GetVnum() == ITEM_HORSE_FOOD_2 || item->GetVnum() == ITEM_HORSE_FOOD_3) { from->FeedHorse(); from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¸»¿¡°Ô »ç·á¸¦ ÁÖ¾ú½À´Ï´Ù.")); item->SetCount(item->GetCount()-1); EffectPacket(SE_HPUP_RED); } break; default: sys_log(0, "TakeItem %s %d %s", from->GetName(), GetRaceNum(), item->GetName()); from->SetQuestNPCID(GetVID()); quest::CQuestManager::instance().TakeItem(from->GetPlayerID(), GetRaceNum(), item); break; } } bool CHARACTER::IsEquipUniqueItem(DWORD dwItemVnum) const { { LPITEM u = GetWear(WEAR_UNIQUE1); if (u && u->GetVnum() == dwItemVnum) return true; } { LPITEM u = GetWear(WEAR_UNIQUE2); if (u && u->GetVnum() == dwItemVnum) return true; } if (dwItemVnum == UNIQUE_ITEM_RING_OF_LANGUAGE) return IsEquipUniqueItem(UNIQUE_ITEM_RING_OF_LANGUAGE_SAMPLE); return false; } // CHECK_UNIQUE_GROUP bool CHARACTER::IsEquipUniqueGroup(DWORD dwGroupVnum) const { { LPITEM u = GetWear(WEAR_UNIQUE1); if (u && u->GetSpecialGroup() == (int) dwGroupVnum) return true; } { LPITEM u = GetWear(WEAR_UNIQUE2); if (u && u->GetSpecialGroup() == (int) dwGroupVnum) return true; } return false; } // END_OF_CHECK_UNIQUE_GROUP #ifdef ENABLE_SPECIAL_STORAGE void CHARACTER::SetRefineMode(TItemPos srcScroll) { m_srcScroll = srcScroll; #else void CHARACTER::SetRefineMode(int iAdditionalCell) { m_iRefineAdditionalCell = iAdditionalCell; #endif m_bUnderRefine = true; } void CHARACTER::ClearRefineMode() { m_bUnderRefine = false; SetRefineNPC( NULL ); } bool CHARACTER::GiveItemFromSpecialItemGroup(DWORD dwGroupNum, std::vector<DWORD> &dwItemVnums, std::vector<DWORD> &dwItemCounts, std::vector <LPITEM> &item_gets, int &count) { const CSpecialItemGroup* pGroup = ITEM_MANAGER::instance().GetSpecialItemGroup(dwGroupNum); if (!pGroup) { sys_err("cannot find special item group %d", dwGroupNum); return false; } std::vector <int> idxes; int n = pGroup->GetMultiIndex(idxes); bool bSuccess; for (int i = 0; i < n; i++) { bSuccess = false; int idx = idxes[i]; DWORD dwVnum = pGroup->GetVnum(idx); DWORD dwCount = pGroup->GetCount(idx); int iRarePct = pGroup->GetRarePct(idx); LPITEM item_get = NULL; switch (dwVnum) { case CSpecialItemGroup::GOLD: PointChange(POINT_GOLD, dwCount); LogManager::instance().CharLog(this, dwCount, "TREASURE_GOLD", ""); bSuccess = true; break; case CSpecialItemGroup::EXP: { PointChange(POINT_EXP, dwCount); LogManager::instance().CharLog(this, dwCount, "TREASURE_EXP", ""); bSuccess = true; } break; case CSpecialItemGroup::MOB: { sys_log(0, "CSpecialItemGroup::MOB %d", dwCount); int x = GetX() + number(-500, 500); int y = GetY() + number(-500, 500); LPCHARACTER ch = CHARACTER_MANAGER::instance().SpawnMob(dwCount, GetMapIndex(), x, y, 0, true, -1); if (ch) ch->SetAggressive(); bSuccess = true; } break; case CSpecialItemGroup::SLOW: { sys_log(0, "CSpecialItemGroup::SLOW %d", -(int)dwCount); AddAffect(AFFECT_SLOW, POINT_MOV_SPEED, -(int)dwCount, AFF_SLOW, 300, 0, true); bSuccess = true; } break; case CSpecialItemGroup::DRAIN_HP: { int iDropHP = GetMaxHP()*dwCount/100; sys_log(0, "CSpecialItemGroup::DRAIN_HP %d", -iDropHP); iDropHP = MIN(iDropHP, GetHP()-1); sys_log(0, "CSpecialItemGroup::DRAIN_HP %d", -iDropHP); PointChange(POINT_HP, -iDropHP); bSuccess = true; } break; case CSpecialItemGroup::POISON: { AttackedByPoison(NULL); bSuccess = true; } break; #ifdef ENABLE_WOLFMAN_CHARACTER case CSpecialItemGroup::BLEEDING: { AttackedByBleeding(NULL); bSuccess = true; } break; #endif case CSpecialItemGroup::MOB_GROUP: { int sx = GetX() - number(300, 500); int sy = GetY() - number(300, 500); int ex = GetX() + number(300, 500); int ey = GetY() + number(300, 500); CHARACTER_MANAGER::instance().SpawnGroup(dwCount, GetMapIndex(), sx, sy, ex, ey, NULL, true); bSuccess = true; } break; default: { item_get = AutoGiveItem(dwVnum, dwCount, iRarePct); if (item_get) { bSuccess = true; } } break; } if (bSuccess) { dwItemVnums.push_back(dwVnum); dwItemCounts.push_back(dwCount); item_gets.push_back(item_get); count++; } else { return false; } } return bSuccess; } // NEW_HAIR_STYLE_ADD bool CHARACTER::ItemProcess_Hair(LPITEM item, int iDestCell) { if (item->CheckItemUseLevel(GetLevel()) == false) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¾ÆÁ÷ ÀÌ ¸Ó¸®¸¦ »ç¿ëÇÒ ¼ö ¾ø´Â ·¹º§ÀÔ´Ï´Ù.")); return false; } DWORD hair = item->GetVnum(); switch (GetJob()) { case JOB_WARRIOR : hair -= 72000; break; case JOB_ASSASSIN : hair -= 71250; break; case JOB_SURA : hair -= 70500; break; case JOB_SHAMAN : hair -= 69750; break; #ifdef ENABLE_WOLFMAN_CHARACTER case JOB_WOLFMAN: break; #endif default : return false; break; } if (hair == GetPart(PART_HAIR)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µ¿ÀÏÇÑ ¸Ó¸® ½ºÅ¸ÀϷδ ±³Ã¼ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return true; } item->SetCount(item->GetCount() - 1); SetPart(PART_HAIR, hair); UpdatePacket(); return true; } // END_NEW_HAIR_STYLE_ADD bool CHARACTER::ItemProcess_Polymorph(LPITEM item) { if (IsPolymorphed()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÀÌ¹Ì µĞ°©ÁßÀÎ »óÅÂÀÔ´Ï´Ù.")); return false; } if (true == IsRiding()) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µĞ°©ÇÒ ¼ö ¾ø´Â »óÅÂÀÔ´Ï´Ù.")); return false; } DWORD dwVnum = item->GetSocket(0); if (dwVnum == 0) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À߸øµÈ µĞ°© ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); item->SetCount(item->GetCount()-1); return false; } const CMob* pMob = CMobManager::instance().Get(dwVnum); if (pMob == NULL) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("À߸øµÈ µĞ°© ¾ÆÀÌÅÛÀÔ´Ï´Ù.")); item->SetCount(item->GetCount()-1); return false; } switch (item->GetVnum()) { case 70104 : case 70105 : case 70106 : case 70107 : case 71093 : { sys_log(0, "USE_POLYMORPH_BALL PID(%d) vnum(%d)", GetPlayerID(), dwVnum); int iPolymorphLevelLimit = MAX(0, 20 - GetLevel() * 3 / 10); if (pMob->m_table.bLevel >= GetLevel() + iPolymorphLevelLimit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("³ªº¸´Ù ³Ê¹« ³ôÀº ·¹º§ÀÇ ¸ó½ºÅͷδ º¯½Å ÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } int iDuration = GetSkillLevel(POLYMORPH_SKILL_ID) == 0 ? 5 : (5 + (5 + GetSkillLevel(POLYMORPH_SKILL_ID)/40 * 25)); iDuration *= 60; DWORD dwBonus = 0; dwBonus = (2 + GetSkillLevel(POLYMORPH_SKILL_ID)/40) * 100; AddAffect(AFFECT_POLYMORPH, POINT_POLYMORPH, dwVnum, AFF_POLYMORPH, iDuration, 0, true); AddAffect(AFFECT_POLYMORPH, POINT_ATT_BONUS, dwBonus, AFF_POLYMORPH, iDuration, 0, false); item->SetCount(item->GetCount()-1); } break; case 50322: { sys_log(0, "USE_POLYMORPH_BOOK: %s(%u) vnum(%u)", GetName(), GetPlayerID(), dwVnum); if (CPolymorphUtils::instance().PolymorphCharacter(this, item, pMob) == true) { CPolymorphUtils::instance().UpdateBookPracticeGrade(this, item); } else { } } break; default : sys_err("POLYMORPH invalid item passed PID(%d) vnum(%d)", GetPlayerID(), item->GetOriginalVnum()); return false; } return true; } bool CHARACTER::CanDoCube() const { if (m_bIsObserver) return false; if (GetShop()) return false; if (GetMyShop()) return false; if (m_bUnderRefine) return false; if (IsWarping()) return false; return true; } bool CHARACTER::UnEquipSpecialRideUniqueItem() { LPITEM Unique1 = GetWear(WEAR_UNIQUE1); LPITEM Unique2 = GetWear(WEAR_UNIQUE2); #ifdef ENABLE_MOUNT_COSTUME_SYSTEM LPITEM MountCostume = GetWear(WEAR_COSTUME_MOUNT); #endif if( NULL != Unique1 ) { if( UNIQUE_GROUP_SPECIAL_RIDE == Unique1->GetSpecialGroup() ) { return UnequipItem(Unique1); } } if( NULL != Unique2 ) { if( UNIQUE_GROUP_SPECIAL_RIDE == Unique2->GetSpecialGroup() ) { return UnequipItem(Unique2); } } #ifdef ENABLE_MOUNT_COSTUME_SYSTEM if (MountCostume) return UnequipItem(MountCostume); #endif return true; } void CHARACTER::AutoRecoveryItemProcess(const EAffectTypes type) { if (true == IsDead() || true == IsStun()) return; if (false == IsPC()) return; if (AFFECT_AUTO_HP_RECOVERY != type && AFFECT_AUTO_SP_RECOVERY != type) return; if (NULL != FindAffect(AFFECT_STUN)) return; { const DWORD stunSkills[] = { SKILL_TANHWAN, SKILL_GEOMPUNG, SKILL_BYEURAK, SKILL_GIGUNG }; for (size_t i=0 ; i < sizeof(stunSkills)/sizeof(DWORD) ; ++i) { const CAffect* p = FindAffect(stunSkills[i]); if (NULL != p && AFF_STUN == p->dwFlag) return; } } const CAffect* pAffect = FindAffect(type); const size_t idx_of_amount_of_used = 1; const size_t idx_of_amount_of_full = 2; if (NULL != pAffect) { LPITEM pItem = FindItemByID(pAffect->dwFlag); if (NULL != pItem && true == pItem->GetSocket(0)) { if (!CArenaManager::instance().IsArenaMap(GetMapIndex()) #ifdef ENABLE_NEWSTUFF && !(g_NoPotionsOnPVP && CPVPManager::instance().IsFighting(GetPlayerID()) && !IsAllowedPotionOnPVP(pItem->GetVnum())) #endif ) { const long amount_of_used = pItem->GetSocket(idx_of_amount_of_used); const long amount_of_full = pItem->GetSocket(idx_of_amount_of_full); const int32_t avail = amount_of_full - amount_of_used; int32_t amount = 0; if (AFFECT_AUTO_HP_RECOVERY == type) { amount = GetMaxHP() - (GetHP() + GetPoint(POINT_HP_RECOVERY)); } else if (AFFECT_AUTO_SP_RECOVERY == type) { amount = GetMaxSP() - (GetSP() + GetPoint(POINT_SP_RECOVERY)); } if (amount > 0) { if (avail > amount) { const int pct_of_used = amount_of_used * 100 / amount_of_full; const int pct_of_will_used = (amount_of_used + amount) * 100 / amount_of_full; bool bLog = false; if ((pct_of_will_used / 10) - (pct_of_used / 10) >= 1) bLog = true; pItem->SetSocket(idx_of_amount_of_used, amount_of_used + amount, bLog); } else { amount = avail; ITEM_MANAGER::instance().RemoveItem( pItem ); } if (AFFECT_AUTO_HP_RECOVERY == type) { PointChange( POINT_HP_RECOVERY, amount ); EffectPacket( SE_AUTO_HPUP ); } else if (AFFECT_AUTO_SP_RECOVERY == type) { PointChange( POINT_SP_RECOVERY, amount ); EffectPacket( SE_AUTO_SPUP ); } } } else { pItem->Lock(false); pItem->SetSocket(0, false); RemoveAffect( const_cast<CAffect*>(pAffect) ); } } else { RemoveAffect( const_cast<CAffect*>(pAffect) ); } } } bool CHARACTER::IsValidItemPosition(TItemPos Pos) const { BYTE window_type = Pos.window_type; WORD cell = Pos.cell; switch (window_type) { case RESERVED_WINDOW: return false; case INVENTORY: case EQUIPMENT: return cell < (INVENTORY_AND_EQUIP_SLOT_MAX); case DRAGON_SOUL_INVENTORY: return cell < (DRAGON_SOUL_INVENTORY_MAX_NUM); #ifdef ENABLE_SPECIAL_STORAGE case UPGRADE_INVENTORY: case BOOK_INVENTORY: case STONE_INVENTORY: case CHEST_INVENTORY: case BONUS_INVENTORY: case VARIUS_INVENTORY: return cell < (SPECIAL_INVENTORY_MAX_NUM); #endif case SAFEBOX: if (NULL != m_pkSafebox) return m_pkSafebox->IsValidPosition(cell); else return false; case MALL: if (NULL != m_pkMall) return m_pkMall->IsValidPosition(cell); else return false; default: return false; } } #define VERIFY_MSG(exp, msg) \ if (true == (exp)) { \ ChatPacket(CHAT_TYPE_INFO, LC_TEXT(msg)); \ return false; \ } bool CHARACTER::CanEquipNow(const LPITEM item, const TItemPos& srcCell, const TItemPos& destCell) /*const*/ { const TItemTable* itemTable = item->GetProto(); //BYTE itemType = item->GetType(); //BYTE itemSubType = item->GetSubType(); switch (GetJob()) { case JOB_WARRIOR: if (item->GetAntiFlag() & ITEM_ANTIFLAG_WARRIOR) return false; break; case JOB_ASSASSIN: if (item->GetAntiFlag() & ITEM_ANTIFLAG_ASSASSIN) return false; break; case JOB_SHAMAN: if (item->GetAntiFlag() & ITEM_ANTIFLAG_SHAMAN) return false; break; case JOB_SURA: if (item->GetAntiFlag() & ITEM_ANTIFLAG_SURA) return false; break; #ifdef ENABLE_WOLFMAN_CHARACTER case JOB_WOLFMAN: if (item->GetAntiFlag() & ITEM_ANTIFLAG_WOLFMAN) return false; break; #endif } for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i) { long limit = itemTable->aLimits[i].lValue; switch (itemTable->aLimits[i].bType) { case LIMIT_LEVEL: if (GetLevel() < limit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("·¹º§ÀÌ ³·¾Æ Âø¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } break; case LIMIT_STR: if (GetPoint(POINT_ST) < limit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("±Ù·ÂÀÌ ³·¾Æ Âø¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } break; case LIMIT_INT: if (GetPoint(POINT_IQ) < limit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Áö´ÉÀÌ ³·¾Æ Âø¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } break; case LIMIT_DEX: if (GetPoint(POINT_DX) < limit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("¹ÎøÀÌ ³·¾Æ Âø¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } break; case LIMIT_CON: if (GetPoint(POINT_HT) < limit) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ü·ÂÀÌ ³·¾Æ Âø¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } break; } } if (item->GetWearFlag() & WEARABLE_UNIQUE) { if ((GetWear(WEAR_UNIQUE1) && GetWear(WEAR_UNIQUE1)->IsSameSpecialGroup(item)) || (GetWear(WEAR_UNIQUE2) && GetWear(WEAR_UNIQUE2)->IsSameSpecialGroup(item))) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°°Àº Á¾·ùÀÇ À¯´ÏÅ© ¾ÆÀÌÅÛ µÎ °³¸¦ µ¿½Ã¿¡ ÀåÂøÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } if (marriage::CManager::instance().IsMarriageUniqueItem(item->GetVnum()) && !marriage::CManager::instance().IsMarried(GetPlayerID())) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("°áÈ¥ÇÏÁö ¾ÊÀº »óÅ¿¡¼­ ¿¹¹°À» Âø¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.")); return false; } } if (item->GetType() == ITEM_COSTUME && item->GetSubType() == COSTUME_BODY) { LPITEM smokin34 = GetWear(WEAR_BODY); if (smokin34 && (smokin34->GetVnum() >= 11901 && smokin34->GetVnum() <= 11914)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Uzerinde gelinlik veya smokin varken kostum giyemezsin.")); return false; } } if (item->GetVnum() >= 11901 && item->GetVnum() <= 11914) { LPITEM smokin44 = GetWear(WEAR_COSTUME_BODY); if (smokin44 && (smokin44->GetType() == ITEM_COSTUME && smokin44->GetSubType() == COSTUME_BODY)) { ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Uzerinde kostum varken smokin veya gelinlik giyemezsin.")); return false; } } return true; } bool CHARACTER::CanUnequipNow(const LPITEM item, const TItemPos& srcCell, const TItemPos& destCell) /*const*/ { if (ITEM_BELT == item->GetType()) VERIFY_MSG(CBeltInventoryHelper::IsExistItemInBeltInventory(this), "º§Æ® Àκ¥Å丮¿¡ ¾ÆÀÌÅÛÀÌ Á¸ÀçÇϸé ÇØÁ¦ÇÒ ¼ö ¾ø½À´Ï´Ù."); if (IS_SET(item->GetFlag(), ITEM_FLAG_IRREMOVABLE)) return false; { int pos = -1; if (item->IsDragonSoul()) pos = GetEmptyDragonSoulInventory(item); else pos = GetEmptyInventory(item->GetSize()); VERIFY_MSG( -1 == pos, "¼ÒÁöÇ°¿¡ ºó °ø°£ÀÌ ¾ø½À´Ï´Ù." ); } return true; } #ifdef ENABLE_SPECIAL_STORAGE LPITEM CHARACTER::GetSpecialStorageItem(WORD wCell, int invType) const { return GetItem(TItemPos(invType, wCell)); } int CHARACTER::GetEmptySpecialStorageSlot(LPITEM pItem) const { if (NULL == pItem || !pItem->GetSpecialWindowType()) return -1; BYTE bSize = pItem->GetSize(); for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { if (IsEmptyItemGrid(TItemPos(pItem->GetSpecialWindowType(), i), bSize)) return i; } return -1; } int CHARACTER::GetEmptySpecialStorageSlot(BYTE bSize, BYTE window_type) const { for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { if (IsEmptyItemGrid(TItemPos(window_type, i), bSize)) return i; } return -1; } #endif
  14. @Itachi 's anger? He doesn't answer my messages. It caused me to lose 4000 players. I'll send you this codes.
  15. No, I'm really sorry for this. I have a problem in my life, its little special. That's why i can't answer some messages. I'm sorry friend, i don't want be bad guy. I find the problem. If your item falls to another one of your group, but you can take this item to your own inventory, then the item is a disappear. Check the video.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.