server/game/src/char_item.cpp

7543 lines
195 KiB
C++
Raw Normal View History

2022-03-05 12:44:06 +02:00
#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"
2022-03-05 19:59:39 +02:00
#include <common/VnumHelper.h>
2022-03-05 12:44:06 +02:00
#include "DragonSoul.h"
#include "buff_on_attributes.h"
#include "belt_inventory_helper.h"
//auction_temp
#ifdef __AUCTION__
#include "auction_manager.h"
#endif
const int ITEM_BROKEN_METIN_VNUM = 28960;
// 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;
}
}
}
};
//<2F><>ȯ<EFBFBD><C8AF>, <20><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>
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)
{
// <20><>Ű<EFBFBD><C5B0><EFBFBD><EFBFBD>
if (IS_MONKEY_DUNGEON(map_index))
return false;
// <20><>
if (IS_CASTLE_MAP(map_index))
return false;
switch (map_index)
{
case 66 : // <20><><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8>
case 71 : // <20>Ź<EFBFBD> <20><><EFBFBD><EFBFBD> 2<><32>
case 72 : // õ<><C3B5> <20><><EFBFBD><EFBFBD>
case 73 : // õ<><C3B5> <20><><EFBFBD><EFBFBD> 2<><32>
case 193 : // <20>Ź<EFBFBD> <20><><EFBFBD><EFBFBD> 2-1<><31>
#if 0
case 184 : // õ<><C3B5> <20><><EFBFBD><EFBFBD>(<28>ż<EFBFBD>)
case 185 : // õ<><C3B5> <20><><EFBFBD><EFBFBD> 2<><32>(<28>ż<EFBFBD>)
case 186 : // õ<><C3B5> <20><><EFBFBD><EFBFBD><><C3B5>)
case 187 : // õ<><C3B5> <20><><EFBFBD><EFBFBD> 2<><32><><C3B5>)
case 188 : // õ<><C3B5> <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)
case 189 : // õ<><C3B5> <20><><EFBFBD><EFBFBD> 2<><32>(<28><><EFBFBD><EFBFBD>)
#endif
// case 206 : // <20>Ʊ͵<C6B1><CDB5><EFBFBD>
case 216 : // <20>Ʊ͵<C6B1><CDB5><EFBFBD>
case 217 : // <20>Ź<EFBFBD> <20><><EFBFBD><EFBFBD> 3<><33>
case 208 : // õ<><C3B5> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>)
return false;
}
if (CBattleArena::IsBattleArenaMap(map_index)) return false;
// <20><><EFBFBD><EFBFBD> private <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ұ<EFBFBD><D2B0><EFBFBD>
if (map_index > 10000) return false;
return true;
}
bool IS_BOTARYABLE_ZONE(int nMapIndex)
{
if (LC_IsYMIR() == false && LC_IsKorea() == false) return true;
switch (nMapIndex)
{
case 1 :
case 3 :
case 21 :
case 23 :
case 41 :
case 43 :
return true;
}
return false;
}
// item socket <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD>԰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ -- by mhh
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 <20><><EFBFBD><EFBFBD> -- 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)
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_MALE))
{
if (SEX_MALE==GET_SEX(ch))
return false;
}
// <20><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>
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;
return true;
}
LPITEM CHARACTER::GetInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(INVENTORY, wCell));
}
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];
default:
return NULL;
}
return NULL;
}
void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem)
{
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;
}
// <20><20>κ<EFBFBD><CEBA>
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;
// wCell + 1 <20><> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ<C3BC><C5A9> <20><> <20><><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD>
m_pointsInstant.bItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.bItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pItems[wCell] = pItem;
}
break;
// <20><>ȥ<EFBFBD><C8A5> <20>κ<EFBFBD><CEBA>
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;
// wCell + 1 <20><> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ<C3BC><C5A9> <20><> <20><><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3><EFBFBD>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD>
m_pointsInstant.wDSItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.wDSItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pDSItems[wCell] = pItem;
}
break;
default:
sys_err ("Invalid Inventory type %d", window_type);
return;
}
if (GetDesc())
{
// Ȯ<><C8AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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();
pack.highlight = (Cell.window_type == DRAGON_SOUL_INVENTORY);
memcpy(pack.alSockets, pItem->GetSockets(), sizeof(pack.alSockets));
memcpy(pack.aAttr, pItem->GetAttributes(), sizeof(pack.aAttr));
2022-03-05 12:44:06 +02:00
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;
}
}
}
LPITEM CHARACTER::GetWear(BYTE bCell) const
{
// > WEAR_MAX_NUM : <20><>ȥ<EFBFBD><C8A5> <20><><EFBFBD>Ե<EFBFBD>.
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)
{
// > WEAR_MAX_NUM : <20><>ȥ<EFBFBD><C8A5> <20><><EFBFBD>Ե<EFBFBD>.
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)
{
// <20>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20><><EFBFBD>־<EFBFBD> <20>Ѵ<EFBFBD>.
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);
}
}
}
bool CHARACTER::IsEmptyItemGrid(TItemPos Cell, BYTE bSize, int iExceptionCell) const
{
switch (Cell.window_type)
{
case INVENTORY:
{
BYTE bCell = Cell.cell;
// bItemCell<6C><6C> 0<><30> false<73><65><EFBFBD><EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> + 1 <20>ؼ<EFBFBD> ó<><C3B3><EFBFBD>Ѵ<EFBFBD>.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> iExceptionCell<6C><6C> 1<><31> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
++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 / 2);
do
{
BYTE p = bCell + (5 * j);
if (p >= INVENTORY_MAX_NUM)
return false;
if (p / (INVENTORY_MAX_NUM / 2) != bPage)
return false;
if (m_pointsInstant.bItemGrid[p])
if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
else
return false;
}
// ũ<>Ⱑ 1<≯<EFBFBD> <20><>ĭ<EFBFBD><C4AD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD>̹Ƿ<CCB9> <20>׳<EFBFBD> <20><><EFBFBD><EFBFBD>
if (1 == bSize)
return true;
else
{
int j = 1;
BYTE bPage = bCell / (INVENTORY_MAX_NUM / 2);
do
{
BYTE p = bCell + (5 * j);
if (p >= INVENTORY_MAX_NUM)
return false;
if (p / (INVENTORY_MAX_NUM / 2) != 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<6C><6C> 0<><30> false<73><65><EFBFBD><EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> + 1 <20>ؼ<EFBFBD> ó<><C3B3><EFBFBD>Ѵ<EFBFBD>.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> iExceptionCell<6C><6C> 1<><31> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
iExceptionCell++;
if (m_pointsInstant.wDSItemGrid[wCell])
{
if (m_pointsInstant.wDSItemGrid[wCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
do
{
BYTE 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;
}
// ũ<>Ⱑ 1<≯<EFBFBD> <20><>ĭ<EFBFBD><C4AD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <20><><EFBFBD>̹Ƿ<CCB9> <20>׳<EFBFBD> <20><><EFBFBD><EFBFBD>
if (1 == bSize)
return true;
else
{
int j = 1;
do
{
BYTE 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;
}
}
}
return false;
2022-03-05 12:44:06 +02:00
}
int CHARACTER::GetEmptyInventory(BYTE size) const
{
// NOTE: <20><><EFBFBD><EFBFBD> <20><> <20>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, ȹ<><C8B9> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20>κ<EFBFBD><CEBA><EFBFBD><E4B8AE> <20><> ĭ<><C4AD> ã<><C3A3> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD> <20>ִµ<D6B4>,
// <09><>Ʈ <20>κ<EFBFBD><CEBA><EFBFBD><E4B8AE> Ư<><C6AF> <20>κ<EFBFBD><CEBA><EFBFBD>̹Ƿ<CCB9> <20>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD> <20>ʵ<EFBFBD><CAB5><EFBFBD> <20>Ѵ<EFBFBD>. (<28><20>κ<EFBFBD><CEBA>丮: INVENTORY_MAX_NUM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˻<EFBFBD>)
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());
}
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
{
// <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> û<><C3BB> <20><>
for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
{
if (!pkOldItem->GetSocket(i))
break;
else
pkNewItem->SetSocket(i, 1);
}
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
int slot = 0;
for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
{
int socket = pkOldItem->GetSocket(i);
2022-03-05 12:44:06 +02:00
if (socket > 2 && socket != ITEM_BROKEN_METIN_VNUM)
pkNewItem->SetSocket(slot++, socket);
}
}
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
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;
}
//<2F><><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD> : upgrade_refine_scroll.quest <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5<><35><EFBFBD>̳<EFBFBD><CCB3><EFBFBD> <20>Ϲ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD>
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȸ<EFBFBD><C8B8> 20 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>"));
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("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
// Check level limit in korea only
if (!g_iUseLocale)
{
for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)
{
int limit = pProto->aLimits[i].lValue;
2022-03-05 12:44:06 +02:00
switch (pProto->aLimits[i].bType)
{
case LIMIT_LEVEL:
if (GetLevel() < limit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
break;
}
}
}
// REFINE_COST
if (GetGold() < cost)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."));
return false;
}
if (!bMoneyOnly && !RefineChance)
{
for (int i = 0; i < prt->material_count; ++i)
{
if (CountSpecifyItem(prt->materials[i].vnum) < prt->materials[i].count)
{
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."));
return false;
}
}
for (int i = 0; i < prt->material_count; ++i)
RemoveSpecifyItem(prt->materials[i].vnum, prt->materials[i].count);
}
2022-11-27 14:36:04 +02:00
int prob = Random::get(1, 100);
2022-03-05 12:44:06 +02:00
if (IsRefineThroughGuild() || bMoneyOnly)
prob -= 10;
// END_OF_REFINE_COST
if (prob <= prt->prob)
{
// <20><><EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>
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
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>з<EFBFBD> <20><><EFBFBD><EFBFBD>
sys_err("cannot create item %u", result_vnum);
NotifyRefineFail(this, item, IsRefineThroughGuild() ? "GUILD" : "POWER");
// END_OF_DETAIL_REFINE_LOG
}
}
else
{
// <20><><EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
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, // <20>߱<EFBFBD><DFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
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();
//<2F><><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD> : upgrade_refine_scroll.quest <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5<><35><EFBFBD>̳<EFBFBD><CCB3><EFBFBD> <20>Ϲ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD>
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;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ
if (m_iRefineAdditionalCell < 0)
return false;
pkItemScroll = GetInventoryItem(m_iRefineAdditionalCell);
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("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
// MUSIN_SCROLL
if (pkItemScroll->GetValue(0) == MUSIN_SCROLL)
{
if (item->GetRefineLevel() >= 4)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
else if (pkItemScroll->GetValue(0) == BDRAGON_SCROLL)
{
if (item->GetType() != ITEM_METIN || item->GetRefineLevel() != 4)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
// Check level limit in korea only
if (!g_iUseLocale)
{
for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)
{
int limit = pProto->aLimits[i].lValue;
2022-03-05 12:44:06 +02:00
switch (pProto->aLimits[i].bType)
{
case LIMIT_LEVEL:
if (GetLevel() < limit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
break;
}
}
}
if (GetGold() < prt->cost)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."));
return false;
}
for (int i = 0; i < prt->material_count; ++i)
{
if (CountSpecifyItem(prt->materials[i].vnum) < prt->materials[i].count)
{
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."));
return false;
}
}
for (int i = 0; i < prt->material_count; ++i)
RemoveSpecifyItem(prt->materials[i].vnum, prt->materials[i].count);
2022-11-27 14:36:04 +02:00
int prob = Random::get(1, 100);
2022-03-05 12:44:06 +02:00
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) // <20><>ö, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0BAB9>, <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3>
{
const char hyuniron_prob[9] = { 100, 75, 65, 55, 45, 40, 35, 25, 20 };
const char hyuniron_prob_euckr[9] = { 100, 75, 65, 55, 45, 40, 35, 30, 25 };
const char yagong_prob[9] = { 100, 100, 90, 80, 70, 60, 50, 30, 20 };
const char yagong_prob_euckr[9] = { 100, 100, 90, 80, 70, 60, 50, 40, 30 };
if (pkItemScroll->GetValue(0) == YONGSIN_SCROLL)
{
if (LC_IsYMIR() == true || LC_IsKorea() == true)
success_prob = hyuniron_prob_euckr[std::clamp(item->GetRefineLevel(), 0, 8)];
2022-03-05 12:44:06 +02:00
else
success_prob = hyuniron_prob[std::clamp(item->GetRefineLevel(), 0, 8)];
2022-03-05 12:44:06 +02:00
}
else if (pkItemScroll->GetValue(0) == YAGONG_SCROLL)
{
if (LC_IsYMIR() == true || LC_IsKorea() == true)
success_prob = yagong_prob_euckr[std::clamp(item->GetRefineLevel(), 0, 8)];
2022-03-05 12:44:06 +02:00
else
success_prob = yagong_prob[std::clamp(item->GetRefineLevel(), 0, 8)];
2022-03-05 12:44:06 +02:00
}
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) // <20><>ö<EFBFBD><C3B6> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>μ<EFBFBD><CEBC><EFBFBD><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
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) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0BAB9><EFBFBD><EFBFBD> 100% <20><><EFBFBD><EFBFBD> (+4<><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
{
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)
{
// <20><><EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>
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
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>з<EFBFBD> <20><><EFBFBD><EFBFBD>
sys_err("cannot create item %u", result_vnum);
NotifyRefineFail(this, item, szRefineType);
}
}
else if (!bDestroyWhenFail && result_fail_vnum)
{
// <20><><EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>
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
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> -> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>з<EFBFBD> <20><><EFBFBD><EFBFBD>
sys_err("cannot create item %u", result_fail_vnum);
NotifyRefineFail(this, item, szRefineType);
}
}
else
{
NotifyRefineFail(this, item, szRefineType); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
PayRefineFee(prt->cost);
}
return true;
}
bool CHARACTER::RefineInformation(BYTE bCell, BYTE bType, int iAdditionalCell)
{
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ÿ<><C5B8> <20>Ϸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EBB0A1><EFBFBD>մϴ<D5B4>."));
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("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (item->GetType() == ITEM_USE && item->GetSubType() == USE_TUNING)
{
if (bType == 0)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
else
{
LPITEM itemScroll = GetInventoryItem(iAdditionalCell);
if (!itemScroll || item->GetVnum() == itemScroll->GetVnum())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ĥ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ö<EFBFBD><C3B6> <20><>ĥ <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
// REFINE_COST
//MAIN_QUEST_LV7
if (GetQuestFlag("main_quest_lv7.refine_chance") > 0)
{
// <20>Ϻ<EFBFBD><CFBA><EFBFBD> <20><><EFBFBD><EFBFBD>
if (!item->CheckItemUseLevel(20) || item->GetType() != ITEM_WEAPON)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȸ<EFBFBD><C8B8> 20 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>"));
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;
memcpy(&p.materials, prt->materials, sizeof(prt->materials));
2022-03-05 12:44:06 +02:00
}
// END_OF_REFINE_COST
GetDesc()->Packet(&p, sizeof(TPacketGCRefineInformation));
SetRefineMode(iAdditionalCell);
return true;
}
bool CHARACTER::RefineItem(LPITEM pkItem, LPITEM pkTarget)
{
if (!CanHandleItem())
return false;
if (pkItem->GetSubType() == USE_TUNING)
{
// XXX <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>...
// XXX <20><><EFBFBD>ɰ<EFBFBD><C9B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0BAB9> <20><><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD>!
// MUSIN_SCROLL
if (pkItem->GetValue(0) == MUSIN_SCROLL)
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_MUSIN, pkItem->GetCell());
// END_OF_MUSIN_SCROLL
else if (pkItem->GetValue(0) == HYUNIRON_CHN)
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_HYUNIRON, pkItem->GetCell());
else if (pkItem->GetValue(0) == BDRAGON_SCROLL)
{
if (pkTarget->GetRefineSet() != 702) return false;
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_BDRAGON, pkItem->GetCell());
}
else
{
if (pkTarget->GetRefineSet() == 501) return false;
RefineInformation(pkTarget->GetCell(), REFINE_TYPE_SCROLL, pkItem->GetCell());
}
}
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++)
{
int socket = pkTarget->GetSocket(i);
2022-03-05 12:44:06 +02:00
if (socket > 2 && socket != ITEM_BROKEN_METIN_VNUM)
{
bHasMetinStone = true;
break;
}
}
if (bHasMetinStone)
{
for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
{
int socket = pkTarget->GetSocket(i);
2022-03-05 12:44:06 +02:00
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]);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ü<EFBFBD><C3BC><EFBFBD>ش<EFBFBD>
pkTarget->SetSocket(i, ITEM_BROKEN_METIN_VNUM);
}
}
pkItem->SetCount(pkItem->GetCount() - 1);
return true;
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><>ƾ<EFBFBD><C6BE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD> <20><>ġ <20>Դϴ<D4B4>."));
return false;
}
int pos;
if (item->GetCount() == 1) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD><EFBFBD> <20>׳<EFBFBD> <20><><EFBFBD><EFBFBD>.
{
item->SetSocket(0, GetX());
item->SetSocket(1, GetY());
}
else if ((pos = GetEmptyInventory(item->GetSize())) != -1) // <20>׷<EFBFBD><D7B7><EFBFBD> <20>ʴٸ<CAB4> <20>ٸ<EFBFBD> <20>κ<EFBFBD><CEBA><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ã<>´<EFBFBD>.
{
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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;
// <20>Ƿ決<C7B7><E6B1BA> <20>϶<EFBFBD>
case 301:
case 302:
case 303:
case 304:
if( GetLevel() < 90 )
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return;
}
else
break;
}
if (iEmpireByMapIndex && GetEmpire() != iEmpireByMapIndex)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> Ÿ<><C5B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>־ <20><>ȯ<EFBFBD><C8AF> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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()
{
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
break;
}
}
// 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);
}
//
// DB ij<>÷<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> User <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ŀ<>ǵ带 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
//
void CHARACTER::UseSilkBotaryReal(const TPacketMyshopPricelistHeader* p)
{
const TItemPriceInfo* pInfo = (const TItemPriceInfo*)(p + 1);
if (!p->byCount)
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD>. dummy <20><><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD> <20><><EFBFBD><EFBFBD> Ŀ<>ǵ带 <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
SendMyShopPriceListCmd(1, 0);
else {
for (int idx = 0; idx < p->byCount; idx++)
SendMyShopPriceListCmd(pInfo[ idx ].dwVnum, pInfo[ idx ].dwPrice);
}
__OpenPrivateShop();
}
//
// <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> ó<><C3B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Open <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> Load <20>ϱ<EFBFBD> <20><><EFBFBD><EFBFBD> DB ij<>ÿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>û <20><>Ŷ<EFBFBD><C5B6> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
// <20><><EFBFBD>ĺ<EFBFBD><C4BA>ʹ<EFBFBD> <20>ٷ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
//
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ڶ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return -1;
}
consumeLife = needLife;
// CheckMinLifeForWarp: <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȵǹǷ<C7B9> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ּҷ<D6BC><D2B7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ŷ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ڶ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return -1;
}
return needSP;
}
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)
{
int limitValue = item->GetProto()->aLimits[i].lValue;
2022-03-05 12:44:06 +02:00
switch (item->GetProto()->aLimits[i].bType)
{
case LIMIT_LEVEL:
if (GetLevel() < limitValue)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ѻ<EFBFBD><D1BA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>Դϴ<D4B4>."));
return false;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ĺ<EFBFBD><C4BA>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʾƵ<CABE> <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3>.
if (-1 != iLimitRealtimeStartFirstUseFlagIndex)
{
// <20><> <20><><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>δ<EFBFBD> Socket1<74><31> <20><><EFBFBD><EFBFBD> <20>Ǵ<EFBFBD><C7B4>Ѵ<EFBFBD>. (Socket1<74><31> <20><><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD> <20><><EFBFBD><EFBFBD>)
if (0 == item->GetSocket(1))
{
// <20><><EFBFBD><EFBFBD>ɽð<C9BD><C3B0><EFBFBD> Default <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Limit Value <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>, Socket0<74><30> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20>Ѵ<EFBFBD>. (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>)
int duration = (0 != item->GetSocket(0)) ? item->GetSocket(0) : item->GetProto()->aLimits[iLimitRealtimeStartFirstUseFlagIndex].lValue;
2022-03-05 12:44:06 +02:00
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);
}
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>Դϴ<D4B4>."));
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(), (int)(GetX()+fx), (int)(GetY()+fy));
2022-03-05 12:44:06 +02:00
if (!tree)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD><EFBFBD><EFBFBD> <20>ǿ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
if (tree->IsAttr((int)(GetX()+fx), (int)(GetY()+fy), ATTR_WATER))
2022-03-05 12:44:06 +02:00
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20>ӿ<EFBFBD> <20><><EFBFBD>ں<EFBFBD><DABA><EFBFBD> <20>ǿ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
2022-11-27 14:36:04 +02:00
LPCHARACTER campfire = CHARACTER_MANAGER::instance().SpawnMob(fishing::CAMPFIRE_MOB, GetMapIndex(), (int)(GetX()+fx), (int)(GetY()+fy), 0, false, Random::get(0, 359));
2022-03-05 12:44:06 +02:00
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: // <20><><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD><EFBFBD><EFBFBD>
if (LC_IsYMIR() == true || LC_IsKorea() == true)
{
if (IS_BOTARYABLE_ZONE(GetMapIndex()) == true)
{
UseSilkBotary();
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>"));
}
}
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: // <20>ű<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
case ITEM_BELT: // <20>ű<EFBFBD> <20><>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// MINING
case ITEM_PICK:
// END_OF_MINING
if (!item->IsEquipped())
EquipItem(item);
else
UnequipItem(item);
break;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ŭ<><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20><><EFBFBD>Ͽ<EFBFBD> item use <20><>Ŷ<EFBFBD><C5B6> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
// <20><>ȥ<EFBFBD><C8A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> item move <20><>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD> <20>Ѵ<EFBFBD>.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>Դϴ<D4B4>."));
return false;
}
if (item->GetSubType() == FISH_ALIVE)
fishing::UseFish(this, item);
}
break;
case ITEM_TREASURE_BOX:
{
return false;
//ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>־ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ°<CAB4> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><20><><EFBFBD>غ<EFBFBD><D8BA><EFBFBD>."));
}
break;
case ITEM_TREASURE_KEY:
{
LPITEM item2;
if (!GetItem(DestCell) || !(item2 = GetItem(DestCell)))
return false;
if (item2->IsExchanging())
return false;
if (item2->GetType() != ITEM_TREASURE_BOX)
{
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴѰ<C6B4> <20><><EFBFBD><EFBFBD>."));
return false;
}
if (item->GetValue(0) == item2->GetValue(0))
{
//ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20>κ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȵǾ<C8B5><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
DWORD dwBoxVnum = item2->GetVnum();
std::vector <DWORD> dwVnums;
std::vector <DWORD> dwCounts;
std::vector <LPITEM> item_gets;
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD> ȹ<><C8B9><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."), dwCounts[i]);
break;
case CSpecialItemGroup::EXP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ź<EFBFBD><C5BA><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ɴϴ<C9B4>."));
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d<><64> <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> ȹ<><C8B9><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."), dwCounts[i]);
break;
case CSpecialItemGroup::MOB:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::SLOW:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD> <20>ӵ<EFBFBD><D3B5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::DRAIN_HP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> <20><><EFBFBD>ڱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."));
break;
case CSpecialItemGroup::POISON:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::MOB_GROUP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
default:
if (item_gets[i])
{
if (dwCounts[i] > 1)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> %s <20><> %d <20><> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."), item_gets[i]->GetName(), dwCounts[i]);
else
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> %s <20><> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."), item_gets[i]->GetName());
}
}
}
}
else
{
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD> <20>ʴ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>."));
return false;
}
}
else
{
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD> <20>ʴ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD>."));
return false;
}
}
break;
case ITEM_GIFTBOX:
{
DWORD dwBoxVnum = item->GetVnum();
std::vector <DWORD> dwVnums;
std::vector <DWORD> dwCounts;
std::vector <LPITEM> item_gets;
2022-03-05 12:44:06 +02:00
int count = 0;
if (dwBoxVnum == 50033 && LC_IsYMIR()) // <20>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
{
if (GetLevel() < 15)
{
ChatPacket(CHAT_TYPE_INFO, "15<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
return false;
}
}
if( (dwBoxVnum > 51500 && dwBoxVnum < 52000) || (dwBoxVnum >= 50255 && dwBoxVnum <= 50260) ) // <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
if( !(this->DragonSoul_IsQualified()) )
{
ChatPacket(CHAT_TYPE_INFO,LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȥ<EFBFBD><C8A5> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20>Ϸ<EFBFBD><CFB7>ϼž<CFBC> <20>մϴ<D5B4>."));
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("<EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD> ȹ<><C8B9><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."), dwCounts[i]);
break;
case CSpecialItemGroup::EXP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ź<EFBFBD><C5BA><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ɴϴ<C9B4>."));
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d<><64> <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> ȹ<><C8B9><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."), dwCounts[i]);
break;
case CSpecialItemGroup::MOB:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::SLOW:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD> <20>ӵ<EFBFBD><D3B5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::DRAIN_HP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> <20><><EFBFBD>ڱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."));
break;
case CSpecialItemGroup::POISON:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::MOB_GROUP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
default:
if (item_gets[i])
{
if (dwCounts[i] > 1)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> %s <20><> %d <20><> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."), item_gets[i]->GetName(), dwCounts[i]);
else
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> %s <20><> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."), item_gets[i]->GetName());
}
}
}
}
else
{
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("<EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD>ų <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
else
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD>ų <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
break;
case ITEM_SKILLBOOK:
{
if (IsPolymorphed())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><EFBFBD><EFBFBD> å<><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
DWORD dwVnum = 0;
if (item->GetVnum() == 50300)
{
dwVnum = item->GetSocket(0);
}
else
{
// <20><><EFBFBD>ο<EFBFBD> <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD> value 0 <20><> <20><>ų <20><>ȣ<EFBFBD><C8A3> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD> <20>װ<EFBFBD><D7B0><EFBFBD> <20><><EFBFBD><EFBFBD>.
dwVnum = item->GetValue(0);
}
if (0 == dwVnum)
{
ITEM_MANAGER::instance().RemoveItem(item);
return false;
}
if (true == LearnSkillByBook(dwVnum))
{
ITEM_MANAGER::instance().RemoveItem(item);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
if (distribution_test_server)
iReadDelay /= 3;
//<2F>ѱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><ECBFA1> <20>ð<EFBFBD><C3B0><EFBFBD> 24<32>ð<EFBFBD> <20><><EFBFBD><EFBFBD>
if (LC_IsKorea())
iReadDelay = 86400;
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("<EFBFBD>̹<EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20>ɷ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
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("<EFBFBD>̹<EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20>ɷ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
}
else
{
// PC_BANG_ITEM_ADD
if (item->IsPCBangItem() == true)
{
// PC<50><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ<C3BC>ؼ<EFBFBD> ó<><C3B3>
if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false)
{
// PC<50><43><EFBFBD><EFBFBD> <20>ƴ<EFBFBD>!
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PC<50><EFBFBD><E6BFA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ѷ<EFBFBD><D1B7><EFBFBD> <20>ʰ<EFBFBD><CAB0>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
break;
default :
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
break;
}
}
bool used = false;
if (item->GetValue(0) != 0) // HP <20><><EFBFBD>밪 ȸ<><C8B8>
{
if (GetHP() < GetMaxHP())
{
PointChange(POINT_HP, item->GetValue(0) * (100 + GetPoint(POINT_POTION_BONUS)) / 100);
EffectPacket(SE_HPUP_RED);
used = true;
2022-03-05 12:44:06 +02:00
}
}
if (item->GetValue(1) != 0) // SP <20><><EFBFBD>밪 ȸ<><C8B8>
{
if (GetSP() < GetMaxSP())
{
PointChange(POINT_SP, item->GetValue(1) * (100 + GetPoint(POINT_POTION_BONUS)) / 100);
EffectPacket(SE_SPUP_BLUE);
used = true;
2022-03-05 12:44:06 +02:00
}
}
if (item->GetValue(3) != 0) // HP % ȸ<><C8B8>
{
if (GetHP() < GetMaxHP())
{
PointChange(POINT_HP, item->GetValue(3) * GetMaxHP() / 100);
EffectPacket(SE_HPUP_RED);
used = true;
2022-03-05 12:44:06 +02:00
}
}
if (item->GetValue(4) != 0) // SP % ȸ<><C8B8>
{
if (GetSP() < GetMaxSP())
{
PointChange(POINT_SP, item->GetValue(4) * GetMaxSP() / 100);
EffectPacket(SE_SPUP_BLUE);
used = true;
2022-03-05 12:44:06 +02:00
}
}
if (used)
{
if (item->GetVnum() == 50085 || item->GetVnum() == 50086)
{
if (test_server)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>Դϴ<D4B4>."));
return false;
}
}
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;
}
// <20><20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> <20>ϵ<EFBFBD><CFB5><EFBFBD> <20>Ѵ<EFBFBD>.
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:%d}", 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:%d}", ret, item->GetVnum(), ITEM_VALUE_CHARGING_AMOUNT_IDX, item->GetValue(ITEM_VALUE_CHARGING_AMOUNT_IDX));
}
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d<><64> <20><>ŭ <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>."), 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:%d}", 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:%d}", item->GetVnum(), ITEM_VALUE_CHARGING_AMOUNT_IDX, item->GetValue(ITEM_VALUE_CHARGING_AMOUNT_IDX));
}
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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;
}
// <20><20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> <20>ϵ<EFBFBD><CFB5><EFBFBD> <20>Ѵ<EFBFBD>.
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<><64> <20><>ŭ <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>."), ret);
sprintf(buf, "Increase %ds by item{VN:%d VAL%d:%d}", 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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
sprintf(buf, "No change by item{VN:%d VAL%d:%d}", 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())
{
//ũ<><C5A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
case ITEM_NOG_POCKET:
{
/*
<EFBFBD><EFBFBD><EFBFBD>ִɷ<EFBFBD>ġ : item_proto value <EFBFBD>ǹ<EFBFBD>
<EFBFBD>̵<EFBFBD><EFBFBD>ӵ<EFBFBD> value 1
<EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD> value 2
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ value 3
<EFBFBD><EFBFBD><EFBFBD>ӽð<EFBFBD> value 0 (<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>)
*/
if (FindAffect(AFFECT_NOG_ABILITY))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>̹<EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20>ɷ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
return false;
}
int time = item->GetValue(0);
int moveSpeedPer = item->GetValue(1);
int attPer = item->GetValue(2);
int expPer = item->GetValue(3);
2022-03-05 12:44:06 +02:00
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;
//<2F>󸶴ܿ<F3B8B6B4> <20><><EFBFBD><EFBFBD>
case ITEM_RAMADAN_CANDY:
{
/*
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD>ġ : item_proto value <EFBFBD>ǹ<EFBFBD>
<EFBFBD>̵<EFBFBD><EFBFBD>ӵ<EFBFBD> value 1
<EFBFBD><EFBFBD><EFBFBD>ݷ<EFBFBD> value 2
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ value 3
<EFBFBD><EFBFBD><EFBFBD>ӽð<EFBFBD> value 0 (<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>)
*/
int time = item->GetValue(0);
int moveSpeedPer = item->GetValue(1);
int attPer = item->GetValue(2);
int expPer = item->GetValue(3);
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>Դϴ<D4B4>."));
break;
}
}
if (pMarriage->ch2 != NULL)
{
if (CArenaManager::instance().IsArenaMap(pMarriage->ch2->GetMapIndex()) == true)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>Դϴ<D4B4>."));
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("<EFBFBD><EFBFBD>ȥ <20><><EFBFBD>°<EFBFBD> <20>ƴϸ<C6B4> <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
break;
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
case UNIQUE_ITEM_CAPE_OF_COURAGE:
//<2F>󸶴<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
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:
// <20><><EFBFBD>ָӴ<D6B8>
{
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 },
};
struct LuckyBagInfo b2[MAX_BAG_INFO] =
{
{ 1000, 302, 1 },
{ 10, 150, 27002 },
{ 10, 75, 27002 },
{ 10, 100, 27005 },
{ 10, 50, 27005 },
{ 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;
if (LC_IsHongKong())
bi = b2;
else
bi = b1;
2022-11-27 14:36:04 +02:00
int pct = Random::get(1, 1000);
2022-03-05 12:44:06 +02:00
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)
{
// <20><>ų<EFBFBD><C5B3><EFBFBD>ü<EFBFBD><C3BC><EFBFBD> Ư<><C6AF><EFBFBD>ϰ<EFBFBD> <20>ش<EFBFBD>.
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: // <20>̺<EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
if (item->GetSocket(0))
{
item->SetSocket(0, item->GetSocket(0) + 1);
}
else
{
// ó<><C3B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̺<EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʴ°<CAB4> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
int dist = 0;
float distance = (DISTANCE_SQRT(GetX()-item->GetSocket(1), GetY()-item->GetSocket(2)));
if (distance < 1000.0f)
{
// <20>߰<EFBFBD>!
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>̺<EFBFBD>Ʈ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20>ź<EFBFBD><C5BA>ο<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
// <20><><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٸ<EFBFBD><D9B8><EFBFBD> <20>Ѵ<EFBFBD>.
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;
2022-11-27 14:36:04 +02:00
int prob = Random::get(1, 100);
2022-03-05 12:44:06 +02:00
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;
// <20><>÷<EFBFBD><C3B7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>
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; // \0 <20><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
const int STONE_DETECT_MAX_TRY = 10;
if (item->GetSocket(0) >= STONE_DETECT_MAX_TRY)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>̺<EFBFBD>Ʈ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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; // \0 <20><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
case 76006: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20>ۿ<EFBFBD><DBBF>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20>ۿ<EFBFBD><DBBF>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
if (item->GetSocket(0) >= 6)
{
ChatPacket(CHAT_TYPE_COMMAND, "StoneDetect %u 0 0", (DWORD)GetVID());
ITEM_MANAGER::instance().RemoveItem(item);
}
}
break;
}
break;
case 27996: // <20><><EFBFBD><EFBFBD>
item->SetCount(item->GetCount() - 1);
/*if (GetSkillLevel(SKILL_CREATE_POISON))
AddAffect(AFFECT_ATT_GRADE, POINT_ATT_GRADE, 3, AFF_DRINK_POISON, 15*60, 0, true);
else
{
// <20><><EFBFBD>ٷ<EFBFBD><D9B7><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 50% <20><><EFBFBD><EFBFBD> 50% <20><><EFBFBD>ݷ<EFBFBD> +2
2022-11-27 14:36:04 +02:00
if (Random::get(0, 1))
2022-03-05 12:44:06 +02:00
{
if (GetHP() > 100)
PointChange(POINT_HP, -(GetHP() - 1));
else
Dead();
}
else
AddAffect(AFFECT_ATT_GRADE, POINT_ATT_GRADE, 2, AFF_DRINK_POISON, 15*60, 0, true);
}*/
break;
case 27987: // <20><><EFBFBD><EFBFBD>
// 50 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 47990
// 30 <20><>
// 10 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 47992
// 7 û<><C3BB><EFBFBD><EFBFBD> 47993
// 3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 47994
{
item->SetCount(item->GetCount() - 1);
2022-11-27 14:36:04 +02:00
int r = Random::get(1, 100);
2022-03-05 12:44:06 +02:00
if (r <= 50)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."));
AutoGiveItem(27990);
}
else
{
const int prob_table_euckr[] =
{
80, 90, 97
};
const int prob_table_gb2312[] =
{
95, 97, 99
};
const int * prob_table = !g_iUseLocale ? prob_table_euckr : prob_table_gb2312;
if (r <= prob_table[0])
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
else if (r <= prob_table[1])
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."));
AutoGiveItem(27992);
}
else if (r <= prob_table[2])
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> û<><C3BB><EFBFBD>ְ<EFBFBD> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."));
AutoGiveItem(27993);
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."));
AutoGiveItem(27994);
}
}
}
break;
case 71013: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2022-11-27 14:36:04 +02:00
CreateFly(Random::get<int>(FLY_FIREWORK1, FLY_FIREWORK6), this);
2022-03-05 12:44:06 +02:00
item->SetCount(item->GetCount() - 1);
break;
case 50100: // <20><><EFBFBD><EFBFBD>
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: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (LC_IsYMIR() == true || LC_IsKorea() == true)
{
if (IS_BOTARYABLE_ZONE(GetMapIndex()) == true)
{
__OpenPrivateShop();
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>"));
}
}
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: // <20><><EFBFBD>ַ<EFBFBD> <20><><EFBFBD>ü<EFBFBD>
case 50302:
case 50303:
{
if (IsPolymorphed() == true)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>а<EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>ɷ<EFBFBD><C9B7><EFBFBD> <20>ø<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
int lv = GetSkillLevel(SKILL_LEADERSHIP);
if (lv < item->GetValue(0))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> å<><C3A5> <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (lv >= item->GetValue(1))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> å<><C3A5> <20>ƹ<EFBFBD><C6B9><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD> <20>ʽ<EFBFBD><CABD>ϴ<EFBFBD>."));
return false;
}
if (LearnSkillByBook(SKILL_LEADERSHIP))
{
ITEM_MANAGER::instance().RemoveItem(item);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
if (distribution_test_server) iReadDelay /= 3;
SetSkillNextReadTime(SKILL_LEADERSHIP, get_global_time() + iReadDelay);
}
}
break;
case 50304: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ü<EFBFBD>
case 50305:
case 50306:
{
if (IsPolymorphed())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><EFBFBD><EFBFBD> å<><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (GetSkillLevel(SKILL_COMBO) == 0 && GetLevel() < 30)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 30<33><30> <20>DZ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20>ʽ<EFBFBD><CABD>ϴ<EFBFBD>."));
return false;
}
if (GetSkillLevel(SKILL_COMBO) == 1 && GetLevel() < 50)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 50<35><30> <20>DZ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20>ʽ<EFBFBD><CABD>ϴ<EFBFBD>."));
return false;
}
if (GetSkillLevel(SKILL_COMBO) >= 2)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
int iPct = item->GetValue(0);
if (LearnSkillByBook(SKILL_COMBO, iPct))
{
ITEM_MANAGER::instance().RemoveItem(item);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
if (distribution_test_server) iReadDelay /= 3;
SetSkillNextReadTime(SKILL_COMBO, get_global_time() + iReadDelay);
}
}
break;
case 50311: // <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ü<EFBFBD>
case 50312:
case 50313:
{
if (IsPolymorphed())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><EFBFBD><EFBFBD> å<><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
DWORD dwSkillVnum = item->GetValue(0);
int iPct = std::clamp(item->GetValue(1), 0, 100);
2022-03-05 12:44:06 +02:00
if (GetSkillLevel(dwSkillVnum)>=20 || dwSkillVnum-SKILL_LANGUAGE1+1 == GetEmpire())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>̹<EFBFBD> <20>Ϻ<EFBFBD><CFBA>ϰ<EFBFBD> <20>˾Ƶ<CBBE><C6B5><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD>."));
return false;
}
if (LearnSkillByBook(dwSkillVnum, iPct))
{
ITEM_MANAGER::instance().RemoveItem(item);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
if (distribution_test_server) iReadDelay /= 3;
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
}
}
break;
case 50061 : // <20>Ϻ<EFBFBD> <20><> <20><>ȯ <20><>ų <20><><EFBFBD>ü<EFBFBD>
{
if (IsPolymorphed())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><EFBFBD><EFBFBD> å<><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
DWORD dwSkillVnum = item->GetValue(0);
int iPct = std::clamp(item->GetValue(1), 0, 100);
2022-03-05 12:44:06 +02:00
if (GetSkillLevel(dwSkillVnum) >= 10)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (LearnSkillByBook(dwSkillVnum, iPct))
{
ITEM_MANAGER::instance().RemoveItem(item);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
if (distribution_test_server) iReadDelay /= 3;
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
}
}
break;
case 50314: case 50315: case 50316: // <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ü<EFBFBD>
case 50323: case 50324: // <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ü<EFBFBD>
case 50325: case 50326: // ö<><C3B6> <20><><EFBFBD>ü<EFBFBD>
{
if (IsPolymorphed() == true)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>а<EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>ɷ<EFBFBD><C9B7><EFBFBD> <20>ø<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
int iSkillLevelLowLimit = item->GetValue(0);
int iSkillLevelHighLimit = item->GetValue(1);
int iPct = std::clamp(item->GetValue(2), 0, 100);
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD> å<><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>÷<EFBFBD><C3B7><EFBFBD> <20>մϴ<D5B4>."));
return false;
}
if (GetSkillLevel(dwSkillVnum) >= 40)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (GetSkillLevel(dwSkillVnum) < iSkillLevelLowLimit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> å<><C3A5> <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (GetSkillLevel(dwSkillVnum) >= iSkillLevelHighLimit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> å<><C3A5><EFBFBD>δ<EFBFBD> <20><> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (LearnSkillByBook(dwSkillVnum, iPct))
{
ITEM_MANAGER::instance().RemoveItem(item);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><EFBFBD><EFBFBD> å<><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
DWORD dwSkillVnum = SKILL_CREATE;
int iPct = std::clamp(item->GetValue(1), 0, 100);
2022-03-05 12:44:06 +02:00
if (GetSkillLevel(dwSkillVnum)>=40)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (LearnSkillByBook(dwSkillVnum, iPct))
{
ITEM_MANAGER::instance().RemoveItem(item);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><EFBFBD><EFBFBD> å<><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
DWORD dwSkillVnum = SKILL_MINING;
int iPct = std::clamp(item->GetValue(1), 0, 100);
2022-03-05 12:44:06 +02:00
if (GetSkillLevel(dwSkillVnum)>=40)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (LearnSkillByBook(dwSkillVnum, iPct))
{
ITEM_MANAGER::instance().RemoveItem(item);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><EFBFBD><EFBFBD> å<><C3A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
DWORD dwSkillVnum = SKILL_HORSE;
int iPct = std::clamp(item->GetValue(1), 0, 100);
2022-03-05 12:44:06 +02:00
if (GetLevel() < 50)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>¸<EFBFBD> <20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴմϴ<D5B4>."));
return false;
}
if (!test_server && get_global_time() < GetSkillNextReadTime(dwSkillVnum))
{
if (FindAffect(AFFECT_SKILL_NO_BOOK_DELAY))
{
// <20>־ȼ<D6BE><C8BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><DFBF><EFBFBD> <20>ð<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
RemoveAffect(AFFECT_SKILL_NO_BOOK_DELAY);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>־ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȭ<EFBFBD>Ը<EFBFBD><D4B8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."));
}
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("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20>¸<EFBFBD> <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
2022-11-27 14:36:04 +02:00
if (Random::get(1, 100) <= iPct)
2022-03-05 12:44:06 +02:00
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>¸<EFBFBD> <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD> <20>о<EFBFBD> <20>¸<EFBFBD> <20><>ų <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD>δ<EFBFBD> <20>¸<EFBFBD> <20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ø<EFBFBD> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
PointChange(POINT_HORSE_SKILL, 1);
2022-11-27 14:36:04 +02:00
int iReadDelay = Random::get<int>(SKILLBOOK_DELAY_MIN, SKILLBOOK_DELAY_MAX);
2022-03-05 12:44:06 +02:00
if (distribution_test_server) iReadDelay /= 3;
if (!test_server)
SetSkillNextReadTime(dwSkillVnum, get_global_time() + iReadDelay);
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>¸<EFBFBD> <20><><EFBFBD>ü<EFBFBD> <20><><EFBFBD>ؿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
ITEM_MANAGER::instance().RemoveItem(item);
}
break;
case 70102: // <20><><EFBFBD><EFBFBD>
case 70103: // <20><><EFBFBD><EFBFBD>
{
if (GetAlignment() >= 0)
return false;
int delta = std::min(-GetAlignment(), item->GetValue(0));
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>𰡰<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̾<EFBFBD>."));
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."), delta/10);
}
}
break;
case 71107: // õ<><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>׽<EFBFBD>Ʈ <20><><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"));
}
}
if (GetAlignment() == 200000)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><EFBFBD> <20><> <20>̻<EFBFBD> <20>ø<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>𰡰<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̾<EFBFBD>."));
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."), 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: // Ż<><C5BB><EFBFBD><EFBFBD>
case 72719:
{
LPITEM item2;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
return false;
if (item2->IsExchanging() == true)
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
return false;
}
break;
default:
return false;
}
std::stack<int> socket;
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
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: // Ż<><C5BB><EFBFBD><EFBFBD>
case 70202: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)
case 70203: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>ݻ<EFBFBD>)
case 70204: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
case 70205: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)
case 70206: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
{
// NEW_HAIR_STYLE_ADD
if (GetPart(PART_HAIR) >= 1001)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ÿ<EEBDBA>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ż<><C5BB><EFBFBD><EFBFBD> <20>Ұ<EFBFBD><D2B0><EFBFBD><EFBFBD>մϴ<D5B4>."));
}
// 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 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD> <20>ٽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."), 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("<EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD> ȹ<><C8B9><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."), 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;
2022-03-05 12:44:06 +02:00
int count = 0;
if (item->GetVnum() == ITEM_VALENTINE_ROSE && SEX_MALE==GET_SEX(this) ||
item->GetVnum() == ITEM_VALENTINE_CHOCOLATE && SEX_FEMALE==GET_SEX(this))
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD>.
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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;
2022-03-05 12:44:06 +02:00
int count = 0;
if (item->GetVnum() == ITEM_WHITEDAY_CANDY && SEX_MALE==GET_SEX(this) ||
item->GetVnum() == ITEM_WHITEDAY_ROSE && SEX_FEMALE==GET_SEX(this))
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD>.
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (GiveItemFromSpecialItemGroup(dwBoxVnum, dwVnums, dwCounts, item_gets, count))
item->SetCount(item->GetCount()-1);
}
break;
case 50011: // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
DWORD dwBoxVnum = 50011;
std::vector <DWORD> dwVnums;
std::vector <DWORD> dwCounts;
std::vector <LPITEM> item_gets;
2022-03-05 12:44:06 +02:00
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("<EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD> ȹ<><C8B9><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."), dwCounts[i]);
break;
case CSpecialItemGroup::EXP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ź<EFBFBD><C5BA><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ɴϴ<C9B4>."));
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%d<><64> <20><><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> ȹ<><C8B9><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."), dwCounts[i]);
break;
case CSpecialItemGroup::MOB:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::SLOW:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̴<EFBFBD> <20>ӵ<EFBFBD><D3B5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::DRAIN_HP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> <20><><EFBFBD>ڱ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."));
break;
case CSpecialItemGroup::POISON:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
case CSpecialItemGroup::MOB_GROUP:
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>!"));
break;
default:
if (item_gets[i])
{
if (dwCounts[i] > 1)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> %s <20><> %d <20><> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."), item_gets[i]->GetName(), dwCounts[i]);
else
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD> %s <20><> <20><><EFBFBD>Խ<EFBFBD><D4BD>ϴ<EFBFBD>."), item_gets[i]->GetName());
}
break;
}
}
}
else
{
ChatPacket(CHAT_TYPE_TALKING, LC_TEXT("<EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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:
{
EffectPacket(SE_CHINA_FIREWORK);
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7>ش<EFBFBD>
AddAffect(AFFECT_CHINA_FIREWORK, POINT_STUN_PCT, 30, AFF_CHINA_FIREWORK, 5*60, 0, true);
item->SetCount(item->GetCount()-1);
}
break;
case 50108:
{
if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>Դϴ<D4B4>."));
return false;
}
EffectPacket(SE_SPIN_TOP);
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>÷<EFBFBD><C3B7>ش<EFBFBD>
AddAffect(AFFECT_CHINA_FIREWORK, POINT_STUN_PCT, 30, AFF_CHINA_FIREWORK, 5*60, 0, true);
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: // <20><><EFBFBD>ٷ<EFBFBD><D9B7><EFBFBD>
{
int iGold = item->GetSocket(0);
ITEM_MANAGER::instance().RemoveItem(item);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD> ȹ<><C8B9><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."), iGold);
PointChange(POINT_GOLD, iGold);
}
break;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ǥ
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0BAB9><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HP,SP<53><50> <20><><EFBFBD><EFBFBD> ä<><C3A4><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), EMPIRE_NAME(GetEmpire()));
SendNoticeMap(szNotice, GetMapIndex(), false);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0BAB9> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
}
break;
case 27995:
{
}
break;
case 71092 : // <20><><EFBFBD><EFBFBD> <20><>ü<EFBFBD><C3BC> <20>ӽ<EFBFBD>
{
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 : // <20><><EFBFBD>
{
// <20><><EFBFBD><EFBFBD>, <20>̰<EFBFBD><CCB0><EFBFBD>, <20><>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (LC_IsEurope() || LC_IsSingapore() || LC_IsVietnam())
return false;
LPITEM item2;
if (!IsValidItemPosition(DestCell) || !(item2 = GetInventoryItem(wDestCell)))
return false;
if (item2->IsExchanging() == true)
return false;
if (item2->GetAttributeSetIndex() == -1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
if (item2->AddRareAttribute() == true)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>߰<EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
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("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
}
}
break;
case 71052 : // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
// <20><><EFBFBD><EFBFBD>, <20>̰<EFBFBD><CCB0><EFBFBD>, <20><>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (LC_IsEurope() || LC_IsSingapore() || LC_IsVietnam())
return false;
LPITEM item2;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
return false;
if (item2->IsExchanging() == true)
return false;
if (item2->GetAttributeSetIndex() == -1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ų <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
}
}
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:
// <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD> <20><> <20><>ġ<EFBFBD><C4A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...
// <20>׷<EFBFBD><D7B7><EFBFBD> <20>׳<EFBFBD> <20>ϵ<EFBFBD> <20>ڵ<EFBFBD>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD> <20>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD>.
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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:
{
RemoveBadAffect();
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ѷ<EFBFBD><D1B7><EFBFBD> <20>ʰ<EFBFBD><CAB0>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
break;
default :
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
bool used = false;
if (item->GetValue(0) != 0) // HP <20><><EFBFBD>밪 ȸ<><C8B8>
{
if (GetHP() < GetMaxHP())
{
PointChange(POINT_HP, item->GetValue(0) * (100 + GetPoint(POINT_POTION_BONUS)) / 100);
EffectPacket(SE_HPUP_RED);
used = true;
2022-03-05 12:44:06 +02:00
}
}
if (item->GetValue(1) != 0) // SP <20><><EFBFBD>밪 ȸ<><C8B8>
{
if (GetSP() < GetMaxSP())
{
PointChange(POINT_SP, item->GetValue(1) * (100 + GetPoint(POINT_POTION_BONUS)) / 100);
EffectPacket(SE_SPUP_BLUE);
used = true;
2022-03-05 12:44:06 +02:00
}
}
if (item->GetValue(3) != 0) // HP % ȸ<><C8B8>
{
if (GetHP() < GetMaxHP())
{
PointChange(POINT_HP, item->GetValue(3) * GetMaxHP() / 100);
EffectPacket(SE_HPUP_RED);
used = true;
2022-03-05 12:44:06 +02:00
}
}
if (item->GetValue(4) != 0) // SP % ȸ<><C8B8>
{
if (GetSP() < GetMaxSP())
{
PointChange(POINT_SP, item->GetValue(4) * GetMaxSP() / 100);
EffectPacket(SE_SPUP_BLUE);
used = true;
2022-03-05 12:44:06 +02:00
}
}
if (used)
{
if (item->GetVnum() == 50085 || item->GetVnum() == 50086)
{
if (test_server)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ѷ<EFBFBD><D1B7><EFBFBD> <20>ʰ<EFBFBD><CAB0>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
break;
default :
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
if (item->GetValue(1) != 0)
{
if (GetPoint(POINT_SP_RECOVERY) + GetSP() >= GetMaxSP())
{
return false;
}
PointChange(POINT_SP_RECOVERY, item->GetValue(1) * std::min(200, (100 + GetPoint(POINT_POTION_BONUS))) / 100);
2022-03-05 12:44:06 +02:00
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) * std::min(200, (100 + GetPoint(POINT_POTION_BONUS))) / 100);
2022-03-05 12:44:06 +02:00
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:
AddAffect(AFFECT_MOV_SPEED, POINT_MOV_SPEED, item->GetValue(2), AFF_MOV_SPEED_POTION, item->GetValue(1), 0, true);
break;
case APPLY_ATT_SPEED:
AddAffect(AFFECT_ATT_SPEED, POINT_ATT_SPEED, item->GetValue(2), AFF_ATT_SPEED_POTION, item->GetValue(1), 0, true);
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;
// gm_guild_build, oxevent <20>ʿ<EFBFBD><CABF><EFBFBD> <20><>ȯ<EFBFBD><C8AF> <20><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD>
if (GetMapIndex() == 200 || GetMapIndex() == 113)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD>Դϴ<D4B4>."));
return false;
}
if (m_pkWarpEvent)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>̵<EFBFBD><EFBFBD><EFBFBD> <20>غ<EFBFBD><D8BA><EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
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) // <20><>ȯ<EFBFBD><C8AF>
{
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD>"));
ProcessRecallItem(item);
}
}
else if (item->GetValue(0) == MEMORY_PORTAL) // <20><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
if (item->GetSocket(0) == 0)
{
if (GetDungeon())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD><EFBFBD> %s%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."),
item->GetName(), "");
2022-03-05 12:44:06 +02:00
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())
return false;
if (item2->GetVnum() >= 28330 && item2->GetVnum() <= 28343) // <20><><EFBFBD><EFBFBD>+3
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("+3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
return false;
}
if (item2->GetVnum() >= 28430 && item2->GetVnum() <= 28443) // <20><><EFBFBD><EFBFBD>+4
{
if (item->GetVnum() == 71056) // û<><C3BB><EFBFBD>Ǽ<EFBFBD><C7BC><EFBFBD>
{
RefineItem(item, item2);
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>"));
}
}
else
{
RefineItem(item, item2);
}
}
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);
}
// [NOTE] <20>ڽ<EFBFBD>Ƭ <20><><EFBFBD><EFBFBD><EFBFBD>ۿ<EFBFBD><DBBF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>ο<EFBFBD><CEBF>ϵ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ƴ޶<C6B4><DEB6><EFBFBD> <20><>û<EFBFBD><C3BB> <20>־<EFBFBD><D6BE><EFBFBD>.
// <20><><EFBFBD><EFBFBD> ANTI_CHANGE_ATTRIBUTE <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Flag<61><67> <20>߰<EFBFBD><DFB0>Ͽ<EFBFBD> <20><>ȹ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20><>Ʈ<EFBFBD><C6AE> <20><> <20><> <20>ֵ<EFBFBD><D6B5><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>̾<EFBFBD><CCBE><EFBFBD><EFBFBD><EFBFBD>
// <20>׵<EFBFBD><D7B5><EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20>ش޷<D8B4><DEB7><EFBFBD> <20>׳<EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD>... -_-
if (ITEM_COSTUME == item2->GetType())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
if (item2->IsExchanging())
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("û<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʽ<EFBFBD><CABD>ϴ<EFBFBD>."));
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 :
if (item2->GetAttributeSetIndex() == -1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
if (item2->GetAttributeCount() == 0)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (GM_PLAYER == GetGMLevel() && false == test_server)
{
//
// Event Flag <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD> <20><EFBFBD><EAB7B6><EFBFBD><EFBFBD> <20>˻<EFBFBD><CBBB>ϰ<EFBFBD>
// <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ش<EFBFBD>.
//
DWORD dwChangeItemAttrCycle = quest::CQuestManager::instance().GetEventFlag(msc_szChangeItemAttrCycleFlag);
if (dwChangeItemAttrCycle < msc_dwDefaultChangeItemAttrCycle)
dwChangeItemAttrCycle = msc_dwDefaultChangeItemAttrCycle;
quest::PC* pPC = quest::CQuestManager::instance().GetPC(GetPlayerID());
if (pPC)
{
DWORD dwNowMin = get_global_time() / 60;
DWORD dwLastChangeItemAttrMin = pPC->GetFlag(msc_szLastChangeItemAttrFlag);
if (dwLastChangeItemAttrMin + dwChangeItemAttrCycle > dwNowMin)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD> <20>ٲ<EFBFBD><D9B2><EFBFBD> %d<><64> <20>̳<EFBFBD><CCB3><EFBFBD><EFBFBD><EFBFBD> <20>ٽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.(%d <20><> <20><><EFBFBD><EFBFBD>)"),
dwChangeItemAttrCycle, dwChangeItemAttrCycle - (dwNowMin - dwLastChangeItemAttrMin));
return false;
}
pPC->SetFlag(msc_szLastChangeItemAttrFlag, dwNowMin);
}
}
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
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ư<><C6AF>ó<EFBFBD><C3B3>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20>߰<EFBFBD> <20>ȵɰŶ<C9B0> <20>Ͽ<EFBFBD> <20>ϵ<EFBFBD> <20>ڵ<EFBFBD><DAB5><EFBFBD>.
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ұ<EFBFBD><D2B0><EFBFBD><EFBFBD>մϴ<D5B4>."));
break;
}
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."));
break;
}
}
item2->ChangeAttribute();
}
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
{
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("<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
if (item2->GetAttributeCount() < 4)
{
// <20><><EFBFBD>簡 Ư<><C6AF>ó<EFBFBD><C3B3>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20>߰<EFBFBD> <20>ȵɰŶ<C9B0> <20>Ͽ<EFBFBD> <20>ϵ<EFBFBD> <20>ڵ<EFBFBD><DAB5><EFBFBD>.
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ұ<EFBFBD><D2B0><EFBFBD><EFBFBD>մϴ<D5B4>."));
break;
}
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ʿ<EFBFBD><CABF><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."));
break;
}
}
char buf[21];
snprintf(buf, sizeof(buf), "%u", item2->GetID());
2022-11-27 14:36:04 +02:00
if (Random::get(1, 100) <= aiItemAttributeAddPercent[item2->GetAttributeCount()])
2022-03-05 12:44:06 +02:00
{
item2->AddAttribute();
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD>Ӽ<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
LogManager::instance().ItemLog(this, item, "ADD_ATTRIBUTE_FAIL", buf);
}
item->SetCount(item->GetCount() - 1);
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̿<EFBFBD><CCBF>Ͽ<EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
break;
case USE_ADD_ATTRIBUTE2 :
// <20><EFBFBD><E0BAB9> <20><><EFBFBD><EFBFBD>
// <20><EFBFBD>񼭸<EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> 4<><34> <20>߰<EFBFBD> <20><>Ų <20><><EFBFBD><EFBFBD><EFBFBD>ۿ<EFBFBD> <20><><EFBFBD>ؼ<EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20><> <20>ٿ<EFBFBD><D9BF>ش<EFBFBD>.
if (item2->GetAttributeSetIndex() == -1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
// <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>̹<EFBFBD> 4<><34> <20>߰<EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>߰<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.
if (item2->GetAttributeCount() == 4)
{
char buf[21];
snprintf(buf, sizeof(buf), "%u", item2->GetID());
2022-11-27 14:36:04 +02:00
if (Random::get(1, 100) <= aiItemAttributeAddPercent[item2->GetAttributeCount()])
2022-03-05 12:44:06 +02:00
{
item2->AddAttribute();
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ӽ<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD>Ӽ<EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD> <20>̻<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̿<EFBFBD><CCBF>Ͽ<EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
else if (item2->GetAttributeCount() < 4)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD>񼭸<EFBFBD> <20>̿<EFBFBD><CCBF>Ͽ<EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD><EFBFBD><EFBFBD> <20>ּ<EFBFBD><D6BC><EFBFBD>."));
}
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)
{
2022-11-27 14:36:04 +02:00
if (Random::get(1, 100) <= 50)
2022-03-05 12:44:06 +02:00
{
item2->SetAccessorySocketMaxGrade(item2->GetAccessorySocketMaxGrade() + 1);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
LogManager::instance().ItemLog(this, item, "ADD_SOCKET_SUCCESS", buf);
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
LogManager::instance().ItemLog(this, item, "ADD_SOCKET_FAIL", buf);
}
item->SetCount(item->GetCount() - 1);
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
}
}
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())
{
2022-11-27 14:36:04 +02:00
if (Random::get(1, 100) <= aiAccessorySocketPutPct[item2->GetAccessorySocketGrade()])
2022-03-05 12:44:06 +02:00
{
item2->SetAccessorySocketGrade(item2->GetAccessorySocketGrade() + 1);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
LogManager::instance().ItemLog(this, item, "PUT_SOCKET_SUCCESS", buf);
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̾Ƹ<CCBE><C6B8><EFBFBD><EFBFBD><EFBFBD> <20>Ǽ<EFBFBD><C7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0>ؾ<EFBFBD><D8BE>մϴ<D5B4>."));
else if (item2->GetAccessorySocketMaxGrade() < ITEM_ACCESSORY_SOCKET_MAX_NUM)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>̾Ƹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0>ؾ<EFBFBD><D8BE>մϴ<D5B4>."));
}
else
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20>׼<EFBFBD><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>̻<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD> <20>̳<EFBFBD><CCB3><EFBFBD> <20><><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD> <20>̳<EFBFBD><CCB3><EFBFBD> <20><><EFBFBD><EFBFBD> %s<><73> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), item->GetName());
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>ô뿡 %s<><73> <20>̳<EFBFBD><CCB3><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), 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("<EFBFBD>̹<EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20>ɷ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
}
else
{
// PC_BANG_ITEM_ADD
if (item->IsPCBangItem() == true)
{
// PC<50><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ<C3BC>ؼ<EFBFBD> ó<><C3B3>
if (CPCBangManager::instance().IsPCBangIP(GetDesc()->GetHostName()) == false)
{
// PC<50><43><EFBFBD><EFBFBD> <20>ƴ<EFBFBD>!
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PC<50><EFBFBD><E6BFA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
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:
2022-11-27 14:36:04 +02:00
AutoGiveItem(Random::get(28000, 28013));
2022-03-05 12:44:06 +02:00
item->SetCount(item->GetCount() - 1);
break;
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ų<EFBFBD><C5B3> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3>
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."));
return false;
}
}
if (dwSourceCount2 != 0)
{
if (pSource2 == NULL)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."));
return false;
}
}
if (pSource1 != NULL)
{
if (pSource1->GetCount() < dwSourceCount1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(%s)<29><> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."), pSource1->GetName());
return false;
}
pSource1->SetCount(pSource1->GetCount() - dwSourceCount1);
}
if (pSource2 != NULL)
{
if (pSource2->GetCount() < dwSourceCount2)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(%s)<29><> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>."), pSource2->GetName());
return false;
}
pSource2->SetCount(pSource2->GetCount() - dwSourceCount2);
}
LPITEM pBottle = FindSpecifyItem(50901);
if (!pBottle || pBottle->GetCount() < 1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ڸ<EFBFBD><DAB8>ϴ<EFBFBD>."));
return false;
}
pBottle->SetCount(pBottle->GetCount() - 1);
2022-11-27 14:36:04 +02:00
if (Random::get(1, 100) > item->GetValue(5))
2022-03-05 12:44:06 +02:00
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>."));
return false;
}
AutoGiveItem(item->GetValue(0));
}
break;
}
}
break;
case ITEM_METIN:
{
LPITEM item2;
if (!IsValidItemPosition(DestCell) || !(item2 = GetItem(DestCell)))
return false;
if (item2->IsExchanging())
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ƾ<EFBFBD><C6BE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD> <20><>ƾ<EFBFBD><C6BE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
else if (item2->GetType() == ITEM_WEAPON)
{
if (!IS_SET(item->GetWearFlag(), WEARABLE_WEAPON))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><>ƾ<EFBFBD><C6BE><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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))
{
// <20><> Ȯ<><C8AE>
2022-11-27 14:36:04 +02:00
if (Random::get(1, 100) <= 30)
2022-03-05 12:44:06 +02:00
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD>ƾ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
item2->SetSocket(i, item->GetVnum());
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD>ƾ<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
item2->SetSocket(i, ITEM_BROKEN_METIN_VNUM);
}
LogManager::instance().ItemLog(this, item2, "SOCKET", item->GetName());
ITEM_MANAGER::instance().RemoveItem(item, "REMOVE (METIN)");
break;
}
if (i == ITEM_SOCKET_MAX_NUM)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
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:
// <20><><EFBFBD>ο<EFBFBD> <20><><EFBFBD>ʵ<EFBFBD>
sys_log(0,"ITEM_BLEND!!");
if (Blend_Item_find(item->GetVnum()))
{
int affect_type = AFFECT_BLEND;
if (item->GetSocket(0) >= _countof(aApplyInfo))
{
sys_err ("INVALID BLEND ITEM(id : %d, vnum : %d). APPLY TYPE IS %d.", item->GetID(), item->GetVnum(), item->GetSocket(0));
return false;
}
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("<EFBFBD>̹<EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20>ɷ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
}
else
{
if (FindAffect(AFFECT_EXP_BONUS_EURO_FREE, POINT_RESIST_MAGIC))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>̹<EFBFBD> ȿ<><C8BF><EFBFBD><EFBFBD> <20>ɷ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
}
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_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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (IsStun())
return false;
if (false == FN_check_item_sex(this, item))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
//PREVENT_TRADE_WINDOW
if (IS_SUMMON_ITEM(item->GetVnum()))
{
if (false == IS_SUMMONABLE_ZONE(GetMapIndex()))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
// <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SUMMONABLE_ZONE<4E><45> <20>ִ°<D6B4><C2B0><EFBFBD> WarpToPC()<29><><EFBFBD><EFBFBD> üũ
//<2F><><EFBFBD>Ÿ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD>θ<EFBFBD> <20><><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD><EFBFBD><EFBFBD>.
if (CThreeWayWar::instance().IsThreeWayWarMapIndex(GetMapIndex()))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD>Ÿ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD><DFBF><EFBFBD> <20><>ȯ<EFBFBD><C8AF>,<2C><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
int iPulse = thecore_pulse();
//â<><C3A2> <20><><EFBFBD><EFBFBD> üũ
if (iPulse - GetSafeboxLoadTime() < PASSES_PER_SEC(g_nPortalLimitTime))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("â<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> %d<><64> <20>̳<EFBFBD><CCB3><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD><C8AF>,<2C><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), 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;
}
//<2F>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD> â üũ
if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>ŷ<EFBFBD>â,â<><C3A2> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD><C8AF>,<2C><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
//PREVENT_REFINE_HACK
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD>üũ
{
if (iPulse - GetRefineTime() < PASSES_PER_SEC(g_nPortalLimitTime))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d<><64> <20>̳<EFBFBD><CCB3><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD><C8AF>,<2C><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), 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("<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d<><64> <20>̳<EFBFBD><CCB3><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD><C8AF>,<2C><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), g_nPortalLimitTime);
return false;
}
}
//END_PREVENT_ITEM_COPY
//<2F><>ȯ<EFBFBD><C8AF> <20>Ÿ<EFBFBD>üũ
if (item->GetVnum() != 70302)
{
PIXEL_POSITION posWarp;
int x = 0;
int y = 0;
double nDist = 0;
const double nDistant = 5000.0;
//<2F><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (item->GetVnum() == 22010)
{
x = item->GetSocket(0) - GetX();
y = item->GetSocket(1) - GetY();
}
//<2F><>ȯ<EFBFBD><C8AF>
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("<EFBFBD>̵<EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
if (test_server)
ChatPacket(CHAT_TYPE_INFO, "PossibleDistant %f nNowDist %f", nDistant,nDist);
return false;
}
}
//PREVENT_PORTAL_AFTER_EXCHANGE
//<2F><>ȯ <20><> <20>ð<EFBFBD>üũ
if (iPulse - GetExchangeTime() < PASSES_PER_SEC(g_nPortalLimitTime))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>ŷ<EFBFBD> <20><> %d<><64> <20>̳<EFBFBD><CCB3><EFBFBD><EFBFBD><EFBFBD> <20><>ȯ<EFBFBD><C8AF>,<2C><>ȯ<EFBFBD><C8AF><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><CEB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), g_nPortalLimitTime);
return false;
}
//END_PREVENT_PORTAL_AFTER_EXCHANGE
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ŷ<EFBFBD>â <20><><EFBFBD><EFBFBD> üũ
if (item->GetVnum() == 50200 | item->GetVnum() == 71049)
{
if (GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>ŷ<EFBFBD>â,â<><C3A2> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
//END_PREVENT_TRADE_WINDOW
if (IS_SET(item->GetFlag(), ITEM_FLAG_LOG)) // <20><><EFBFBD><EFBFBD> <20>α׸<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<><C3B3>
{
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)) // UseItemEx<45><78><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ǿ<EFBFBD><C7BE><EFBFBD>. <20><><EFBFBD><EFBFBD> <20>α׸<CEB1> <20><><EFBFBD><EFBFBD>
{
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("<EFBFBD><EFBFBD>ȭâ<EFBFBD><EFBFBD> <20><> <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ű<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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 (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_DROP | ITEM_ANTIFLAG_GIVE))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
if (bCount == 0 || bCount > item->GetCount())
bCount = item->GetCount();
SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, 255); // Quickslot <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
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;
}
// check non-split items for china
//if (LC_IsNewCIBN())
// if (item->GetVnum() == 71095 || item->GetVnum() == 71050 || item->GetVnum() == 70038)
// 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))
{
// <20>ѱ<EFBFBD><D1B1><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ش޶<D8B4><DEB6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ƽ<EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٴڿ<D9B4> <20><><EFBFBD><EFBFBD> <20><> <20>Ӽ<EFBFBD><D3BC>α׸<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
if (LC_IsYMIR())
item->AttrLog();
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3<><33> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
pkItemToDrop->StartDestroyEvent();
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;
}
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD> <20><><EFBFBD>װ<EFBFBD> <20>ִµ<D6B4>,
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD>,
// <20><>ũ<EFBFBD>γ<EFBFBD>, <20><><EFBFBD><EFBFBD> <20>Ἥ 1000<30><30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>带 0<><30><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٰ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>û<EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ִ<EFBFBD>.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>׷<EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><20><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> <20>α׸<CEB1> <20><><EFBFBD><EFBFBD>.
if (LC_IsBrazil() == true)
{
if (gold >= 213)
LogManager::instance().CharLog(this, gold, "DROP_GOLD", "");
}
else
{
if (gold > 1000) // õ<><C3B5> <20>̻<EFBFBD><CCBB><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
LogManager::instance().CharLog(this, gold, "DROP_GOLD", "");
}
if (false == LC_IsBrazil())
{
item->StartDestroyEvent(150);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d<><64> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), 150/60);
}
else
{
item->StartDestroyEvent(60);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d<><64> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."), 1);
}
}
Save();
return true;
}
return false;
}
bool CHARACTER::MoveItem(TItemPos Cell, TItemPos DestCell, BYTE count)
{
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("<EFBFBD><EFBFBD>ȭâ<EFBFBD><EFBFBD> <20><> <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ű<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
// <20><>ȹ<EFBFBD><C8B9><EFBFBD><EFBFBD> <20><>û<EFBFBD><C3BB><EFBFBD><EFBFBD> <20><>Ʈ <20>κ<EFBFBD><CEBA><EFBFBD><E4B8AE><EFBFBD><EFBFBD> Ư<><C6AF> Ÿ<><C5B8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>۸<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD>.
if (DestCell.IsBeltInventoryPosition() && false == CBeltInventoryHelper::CanMoveIntoBeltInventory(item))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>Ʈ <20>κ<EFBFBD><CEBA><EFBFBD><E4B8AE> <20>ű<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
// <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ű<EFBFBD><C5B1><EFBFBD> <20><><EFBFBD><EFBFBD>, '<27><>å <20><><EFBFBD><EFBFBD>' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> Ȯ<><C8AE><EFBFBD>ϰ<EFBFBD> <20>ű<EFBFBD>
if (Cell.IsEquipPosition() && !CanUnequipNow(item))
return false;
if (DestCell.IsEquipPosition())
{
if (GetItem(DestCell)) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD><CBBB>ص<EFBFBD> <20>ȴ<EFBFBD>.
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
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;
}
}
// <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȥ<EFBFBD><C8A5> <20>κ<EFBFBD><CEBA><EFBFBD> <20><><EFBFBD><20><> <20><><EFBFBD><EFBFBD>.
else if (DRAGON_SOUL_INVENTORY == DestCell.window_type)
return false;
LPITEM item2;
if ((item2 = GetItem(DestCell)) && item != item2 && item2->IsStackable() &&
!IS_SET(item2->GetAntiFlag(), ITEM_ANTIFLAG_STACK) &&
item2->GetVnum() == item->GetVnum()) // <20><>ĥ <20><> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
{
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 = std::min<BYTE>(200 - item2->GetCount(), count);
2022-03-05 12:44:06 +02:00
item->SetCount(item->GetCount() - count);
item2->SetCount(item2->GetCount() + count);
return true;
}
if (!IsEmptyItemGrid(DestCell, item->GetSize(), Cell.cell))
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();
SetItem(DestCell, item);
if (INVENTORY == Cell.window_type && INVENTORY == DestCell.window_type)
SyncQuickslot(QUICKSLOT_TYPE_ITEM, Cell.cell, DestCell.cell);
}
else if (count < item->GetCount())
{
//check non-split items
//if (LC_IsNewCIBN())
//{
// if (item->GetVnum() == 71095 || item->GetVnum() == 71050 || item->GetVnum() == 70038)
// {
// return false;
// }
//}
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) // õ<><C3B5> <20>̻<EFBFBD><CCBB><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
LogManager::instance().CharLog(ch, iMoney, "GET_GOLD", "");
}
}
};
}
void CHARACTER::GiveGold(int iAmount)
{
if (iAmount <= 0)
return;
sys_log(0, "GIVE_GOLD: %s %d", GetName(), iAmount);
if (GetParty())
{
LPPARTY pParty = GetParty();
// <20><>Ƽ<EFBFBD><C6BC> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
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) // õ<><C3B5> <20>̻<EFBFBD><CCBB><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
LogManager::instance().CharLog(this, dwMyAmount, "GET_GOLD", "");
}
else
{
PointChange(POINT_GOLD, iAmount, true);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD> <20><><EFBFBD>װ<EFBFBD> <20>ִµ<D6B4>,
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD> <20>߿<EFBFBD> <20>ϳ<EFBFBD><CFB3><EFBFBD>,
// <20><>ũ<EFBFBD>γ<EFBFBD>, <20><><EFBFBD><EFBFBD> <20>Ἥ 1000<30><30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>带 0<><30><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٰ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>û<EFBFBD>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ִ<EFBFBD>.
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>׷<EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><20><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> <20>α׸<CEB1> <20><><EFBFBD><EFBFBD>.
if (LC_IsBrazil() == true)
{
if (iAmount >= 213)
LogManager::instance().CharLog(this, iAmount, "GET_GOLD", "");
}
else
{
if (iAmount > 1000) // õ<><C3B5> <20>̻<EFBFBD><CCBB><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
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))
{
if (item->IsOwnership(this))
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ũ<EFBFBD><C5A9><EFBFBD><EFBFBD>
if (item->GetType() == ITEM_ELK)
{
GiveGold(item->GetCount());
item->RemoveFromGround();
M2_DESTROY_ITEM(item);
Save();
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD>
else
{
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 = std::min<BYTE>(200 - item2->GetCount(), bCount);
2022-03-05 12:44:06 +02:00
bCount -= bCount2;
item2->SetCount(item2->GetCount() + bCount2);
if (bCount == 0)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>: %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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
item->RemoveFromGround();
if (item->IsDragonSoul())
item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>: %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())
{
// <20>ٸ<EFBFBD> <20><>Ƽ<EFBFBD><C6BC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ѵٸ<D1B4>
NPartyPickupDistribute::FFindOwnership funcFindOwnership(item);
GetParty()->ForEachOnlineMember(funcFindOwnership);
LPCHARACTER owner = funcFindOwnership.owner;
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
}
else
{
if (!(owner && (iEmptyCell = owner->GetEmptyInventory(item->GetSize())) != -1))
{
owner = this;
if ((iEmptyCell = GetEmptyInventory(item->GetSize())) == -1)
{
owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
}
item->RemoveFromGround();
if (item->IsDragonSoul())
item->AddToCharacter(owner, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>: %s"), item->GetName());
else
{
owner->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>: %s <20><><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA><EFBFBD> %s"), GetName(), item->GetName());
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: %s <20>Կ<EFBFBD><D4BF><EFBFBD> %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);
// <20>ùٸ<C3B9> Cell <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD>
// <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> Swap<61><70> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>, <20><><EFBFBD><20>ɸ<EFBFBD>.
//if (bCell >= INVENTORY_MAX_NUM + WEAR_MAX_NUM || bDestCell >= INVENTORY_MAX_NUM + WEAR_MAX_NUM)
if (srcCell.IsDragonSoulEquipPosition() || destCell.IsDragonSoulEquipPosition())
return false;
// <20><><EFBFBD><EFBFBD> CELL <20><><EFBFBD><EFBFBD> <20>˻<EFBFBD>
if (bCell == bDestCell)
return false;
// <20><> <20><> <20><><EFBFBD><EFBFBD>â <20><>ġ<EFBFBD><C4A1> Swap <20><> <20><> <20><><EFBFBD><EFBFBD>.
if (srcCell.IsEquipPosition() && destCell.IsEquipPosition())
return false;
LPITEM item1, item2;
// item2<6D><32> <20><><EFBFBD><EFBFBD>â<EFBFBD><C3A2> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ǵ<EFBFBD><C7B5><EFBFBD>.
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;
}
// item2<6D><32> bCell<6C><6C>ġ<EFBFBD><C4A1> <20><><EFBFBD><20><> <20>ִ<EFBFBD><D6B4><EFBFBD> Ȯ<><C8AE><EFBFBD>Ѵ<EFBFBD>.
if (!IsEmptyItemGrid(TItemPos (INVENTORY, item1->GetCell()), item2->GetSize(), item1->GetCell()))
return false;
// <20>ٲ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>â<EFBFBD><C3A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (TItemPos(EQUIPMENT, item2->GetCell()).IsEquipPosition())
{
BYTE bEquipCell = item2->GetCell() - INVENTORY_MAX_NUM;
BYTE bInvenCell = item1->GetCell();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ְ<EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>¿<EFBFBD><C2BF>߸<EFBFBD> <20><><EFBFBD><EFBFBD>
if (false == CanUnequipNow(item2) || false == CanEquipNow(item1))
return false;
if (bEquipCell != item1->FindEquipCell(this)) // <20><><EFBFBD><EFBFBD> <20><>ġ<EFBFBD>϶<EFBFBD><CFB6><EFBFBD> <20><><EFBFBD><EFBFBD>
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)
{
int pos;
if (false == CanUnequipNow(item))
return false;
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;
}
//
// @version 05/07/05 Bang2ni - Skill <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1.5 <20><> <20>̳<EFBFBD><CCB3><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
//
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;
// <20><><EFBFBD>𰡸<EFBFBD> ź <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> <20>νõ<CEBD> <20>Ա<EFBFBD> <20><><EFBFBD><EFBFBD>
if (iWearCell == WEAR_BODY && IsRiding() && (item->GetVnum() >= 11901 && item->GetVnum() <= 11904))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ź <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (iWearCell != WEAR_ARROW && IsPolymorphed())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>а<EFBFBD> <20>߿<EFBFBD><DFBF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (FN_check_item_sex(this, item) == false)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
//<2F>ű<EFBFBD> Ż<><C5BB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EBBFA9> üũ
if(item->IsRideItem() && IsRiding())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>̹<EFBFBD> Ż<><C5BB><EFBFBD><EFBFBD> <20>̿<EFBFBD><CCBF><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
// ȭ<><C8AD> <20>̿ܿ<CCBF><DCBF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ð<EFBFBD> <20>Ǵ<EFBFBD> <20><>ų <20><><EFBFBD><EFBFBD> 1.5 <20>Ŀ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ü<EFBFBD><C3BC> <20><><EFBFBD><EFBFBD>
DWORD dwCurTime = get_dword_time();
if (iWearCell != WEAR_ARROW
&& (dwCurTime - GetLastAttackTime() <= 1500 || dwCurTime - m_dwLastSkillTime <= 1500))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>."));
return false;
}
// <20><>ȥ<EFBFBD><C8A5> Ư<><C6AF> ó<><C3B3>
if (item->IsDragonSoul())
{
// <20><><EFBFBD><EFBFBD> Ÿ<><C5B8><EFBFBD><EFBFBD> <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20>̹<EFBFBD> <20><><EFBFBD><20>ִٸ<D6B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>.
// <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> swap<61><70> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20>ȵ<EFBFBD>.
if(GetInventoryItem(INVENTORY_MAX_NUM + iWearCell))
{
ChatPacket(CHAT_TYPE_INFO, "<EFBFBD>̹<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ֽ<EFBFBD><D6BD>ϴ<EFBFBD>.");
return false;
}
if (!item->EquipTo(this, iWearCell))
{
return false;
}
}
// <20><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD> <20>ƴ<EFBFBD>.
else
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִٸ<D6B4>,
if (GetWear(iWearCell) && !IS_SET(GetWear(iWearCell)->GetFlag(), ITEM_FLAG_IRREMOVABLE))
{
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ѹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ұ<EFBFBD>. swap <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ұ<EFBFBD>
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())
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ĺ<EFBFBD><C4BA>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʾƵ<CABE> <20>ð<EFBFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3>.
if (-1 != item->GetProto()->cLimitRealTimeFirstUseIndex)
{
// <20><> <20><><EFBFBD>̶<EFBFBD><CCB6><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>δ<EFBFBD> Socket1<74><31> <20><><EFBFBD><EFBFBD> <20>Ǵ<EFBFBD><C7B4>Ѵ<EFBFBD>. (Socket1<74><31> <20><><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD> <20><><EFBFBD><EFBFBD>)
if (0 == item->GetSocket(1))
{
// <20><><EFBFBD><EFBFBD>ɽð<C9BD><C3B0><EFBFBD> Default <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Limit Value <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>, Socket0<74><30> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20>Ѵ<EFBFBD>. (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>)
int duration = (0 != item->GetSocket(0)) ? item->GetSocket(0) : item->GetProto()->aLimits[item->GetProto()->cLimitRealTimeFirstUseIndex].lValue;
2022-03-05 12:44:06 +02:00
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();
// <20>󸶴<EFBFBD> <20>̺<EFBFBD>Ʈ <20>ʽ´<CABD><C2B4><EFBFBD> <20><><EFBFBD><EFBFBD>(71135) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20>ߵ<EFBFBD>
if (true == CItemVnumHelper::IsRamadanMoonRing(dwVnum))
{
this->EffectPacket(SE_EQUIP_RAMADAN_RING);
}
// <20>ҷ<EFBFBD><D2B7><EFBFBD> <20><><EFBFBD><EFBFBD>(71136) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20>ߵ<EFBFBD>
else if (true == CItemVnumHelper::IsHalloweenCandy(dwVnum))
{
this->EffectPacket(SE_EQUIP_HALLOWEEN_CANDY);
}
// <20><EFBFBD><E0BAB9> <20><><EFBFBD><EFBFBD>(71143) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20>ߵ<EFBFBD>
else if (true == CItemVnumHelper::IsHappinessRing(dwVnum))
{
this->EffectPacket(SE_EQUIP_HAPPINESS_RING);
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҵ<EFBFBD>Ʈ(71145) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20>ߵ<EFBFBD>
else if (true == CItemVnumHelper::IsLovePendant(dwVnum))
{
this->EffectPacket(SE_EQUIP_LOVE_PENDANT);
}
// ITEM_UNIQUE<55><45> <20><><EFBFBD><EFBFBD>, SpecialItemGroup<75><70> <20><><EFBFBD>ǵǾ<C7B5> <20>ְ<EFBFBD>, (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());
}
}
}
if (UNIQUE_SPECIAL_RIDE == item->GetSubType() && IS_SET(item->GetFlag(), ITEM_FLAG_QUEST_USE))
{
quest::CQuestManager::instance().UseItem(GetPlayerID(), item, false);
}
}
return true;
}
void CHARACTER::BuffOnAttr_AddBuffsFromItem(LPITEM pItem)
{
for (int 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 (int 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;
if (m_map_buff_on_attrs.end() == it)
{
switch (bType)
{
case POINT_ENERGY:
{
static BYTE abSlot[] = { WEAR_BODY, WEAR_HEAD, WEAR_FOOTS, WEAR_WRIST, WEAR_WEAPON, WEAR_NECK, WEAR_EAR, WEAR_SHIELD };
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 };
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;
pBuff->On(bNewValue);
}
else
{
if (m_map_buff_on_attrs.end() == it)
return;
else
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);
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);
}
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;
}
int CHARACTER::CountSpecifyItem(DWORD vnum) const
{
int count = 0;
LPITEM item;
for (int i = 0; i < INVENTORY_MAX_NUM; ++i)
{
item = GetInventoryItem(i);
if (NULL != item && item->GetVnum() == vnum)
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ϵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD≯<EFBFBD> <20>Ѿ<D1BE><EEB0A3>.
if (m_pkMyShop && m_pkMyShop->IsSellingItem(item->GetID()))
{
continue;
}
else
{
count += item->GetCount();
}
}
}
return count;
}
void CHARACTER::RemoveSpecifyItem(DWORD vnum, DWORD count)
{
if (0 == count)
return;
for (UINT i = 0; i < INVENTORY_MAX_NUM; ++i)
{
if (NULL == GetInventoryItem(i))
continue;
if (GetInventoryItem(i)->GetVnum() != vnum)
continue;
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ϵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD≯<EFBFBD> <20>Ѿ<D1BE><EEB0A3>. (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǹŵɶ<C5B5> <20><> <20>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>!)
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;
}
}
// <20><><EFBFBD><EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD> <20><><EFBFBD>ϴ<EFBFBD>.
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;
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ϵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD≯<EFBFBD> <20>Ѿ<D1BE><EEB0A3>. (<28><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ǹŵɶ<C5B5> <20><> <20>κ<EFBFBD><CEBA><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>!)
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);
}
else
{
cell = GetEmptyInventory (item->GetSize());
}
if (cell != -1)
{
if (item->IsDragonSoul())
item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, cell));
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());
item->StartDestroyEvent();
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 = std::min<BYTE>(200 - item->GetCount(), bCount);
2022-03-05 12:44:06 +02:00
bCount -= bCount2;
item->SetCount(item->GetCount() + bCount2);
if (bCount == 0)
{
if (bMsg)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>: %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() < ITEM_MAX_COUNT)
{
inv_item->SetCount(inv_item->GetCount() + item->GetCount());
return inv_item;
}
}
}
}
}
int iEmptyCell;
if (item->IsDragonSoul())
{
iEmptyCell = GetEmptyDragonSoulInventory(item);
}
else
iEmptyCell = GetEmptyInventory(item->GetSize());
if (iEmptyCell != -1)
{
if (bMsg)
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ȹ<><C8B9>: %s"), item->GetName());
if (item->IsDragonSoul())
item->AddToCharacter(this, TItemPos(DRAGON_SOUL_INVENTORY, iEmptyCell));
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());
item->StartDestroyEvent();
// <20><>Ƽ <20><><EFBFBD><EFBFBD> flag<61><67> <20>ɷ<EFBFBD><C9B7>ִ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>,
// <20>κ<EFBFBD><CEBA><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><>¿ <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20>Ǹ<EFBFBD>,
// ownership<69><70> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(300<30><30>) <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
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;
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:
// <20>ʱ<EFBFBD> <20><>
if (item->GetVnum() == ITEM_REVIVE_HORSE_1)
{
if (!IsDead())
{
from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ʸ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
return true;
}
else if (item->GetVnum() == ITEM_HORSE_FOOD_1)
{
if (IsDead())
{
from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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:
// <20>߱<EFBFBD> <20><>
if (item->GetVnum() == ITEM_REVIVE_HORSE_2)
{
if (!IsDead())
{
from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ʸ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
return true;
}
else if (item->GetVnum() == ITEM_HORSE_FOOD_2)
{
if (IsDead())
{
from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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:
// <20><><EFBFBD><EFBFBD> <20><>
if (item->GetVnum() == ITEM_REVIVE_HORSE_3)
{
if (!IsDead())
{
from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ʸ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
return true;
}
else if (item->GetVnum() == ITEM_HORSE_FOOD_3)
{
if (IsDead())
{
from->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
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("<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ʸ<EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
}
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20>־<EFBFBD><D6BE><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28>ߺ<EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ<C3BC>Ѵ<EFBFBD>.
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
void CHARACTER::SetRefineMode(int iAdditionalCell)
{
m_iRefineAdditionalCell = iAdditionalCell;
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);
2022-11-27 14:36:04 +02:00
int x = GetX() + Random::get(-500, 500);
int y = GetY() + Random::get(-500, 500);
2022-03-05 12:44:06 +02:00
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 = std::min(iDropHP, GetHP()-1);
2022-03-05 12:44:06 +02:00
sys_log(0, "CSpecialItemGroup::DRAIN_HP %d", -iDropHP);
PointChange(POINT_HP, -iDropHP);
bSuccess = true;
}
break;
case CSpecialItemGroup::POISON:
{
AttackedByPoison(NULL);
bSuccess = true;
}
break;
case CSpecialItemGroup::MOB_GROUP:
{
2022-11-27 14:36:04 +02:00
int sx = GetX() - Random::get(300, 500);
int sy = GetY() - Random::get(300, 500);
int ex = GetX() + Random::get(300, 500);
int ey = GetY() + Random::get(300, 500);
2022-03-05 12:44:06 +02:00
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)
{
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ѿ<EFBFBD> <20>ɸ<EFBFBD>
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>Ӹ<EFBFBD><D3B8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
DWORD hair = item->GetVnum();
switch (GetJob())
{
case JOB_WARRIOR :
hair -= 72000; // 73001 - 72000 = 1001 <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȣ <20><><EFBFBD><EFBFBD>
break;
case JOB_ASSASSIN :
hair -= 71250;
break;
case JOB_SURA :
hair -= 70500;
break;
case JOB_SHAMAN :
hair -= 69750;
break;
default :
return false;
break;
}
if (hair == GetPart(PART_HAIR))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӹ<EFBFBD> <20><>Ÿ<EFBFBD>Ϸδ<CFB7> <20><>ü<EFBFBD><C3BC> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD>̹<EFBFBD> <20>а<EFBFBD><D0B0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
if (true == IsRiding())
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>а<EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
return false;
}
DWORD dwVnum = item->GetSocket(0);
if (dwVnum == 0)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>߸<EFBFBD><EFBFBD><EFBFBD> <20>а<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
item->SetCount(item->GetCount()-1);
return false;
}
const CMob* pMob = CMobManager::instance().Get(dwVnum);
if (pMob == NULL)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>߸<EFBFBD><EFBFBD><EFBFBD> <20>а<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դϴ<D4B4>."));
item->SetCount(item->GetCount()-1);
return false;
}
switch (item->GetVnum())
{
case 70104 :
case 70105 :
case 70106 :
case 70107 :
case 71093 :
{
// <20>а<EFBFBD><D0B0><EFBFBD> ó<><C3B3>
sys_log(0, "USE_POLYMORPH_BALL PID(%d) vnum(%d)", GetPlayerID(), dwVnum);
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> üũ
int iPolymorphLevelLimit = std::max(0, 20 - GetLevel() * 3 / 10);
2022-03-05 12:44:06 +02:00
if (pMob->m_table.bLevel >= GetLevel() + iPolymorphLevelLimit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʹ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ͷδ<CDB7> <20><><EFBFBD><EFBFBD> <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
int iDuration = GetSkillLevel(POLYMORPH_SKILL_ID) == 0 ? 5 : (5 + (5 + GetSkillLevel(POLYMORPH_SKILL_ID)/40 * 25));
iDuration *= 60;
DWORD dwBonus = 0;
if (true == LC_IsYMIR() || true == LC_IsKorea())
{
dwBonus = GetSkillLevel(POLYMORPH_SKILL_ID) + 60;
}
else
{
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:
{
// <20><><EFBFBD><EFBFBD>
// <20>а<EFBFBD><D0B0><EFBFBD> ó<><C3B3>
// <20><><EFBFBD><EFBFBD>0 <20><><EFBFBD><EFBFBD>1 <20><><EFBFBD><EFBFBD>2
// <20>а<EFBFBD><D0B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȣ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>а<EFBFBD><D0B0><EFBFBD> <20><><EFBFBD><EFBFBD>
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);
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);
}
}
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 (false == CArenaManager::instance().IsArenaMap(GetMapIndex()))
{
const int amount_of_used = pItem->GetSocket(idx_of_amount_of_used);
const int amount_of_full = pItem->GetSocket(idx_of_amount_of_full);
2022-03-05 12:44:06 +02:00
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;
// <20><><EFBFBD><EFBFBD><EBB7AE> 10% <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α׸<CEB1> <20><><EFBFBD><EFBFBD>
// (<28><><EFBFBD><EFBFBD><EBB7AE> %<25><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20>ڸ<EFBFBD><DAB8><EFBFBD> <20>ٲ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>α׸<CEB1> <20><><EFBFBD><EFBFBD>.)
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);
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;
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƽ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ũ<EFBFBD><C5A9>.. exp<78><70> true<75><65> msg<73><67> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> return false <20>ϴ<EFBFBD> <20><>ũ<EFBFBD><C5A9> (<28>Ϲ<EFBFBD><CFB9><EFBFBD><EFBFBD><EFBFBD> verify <20><EFBFBD><EBB5B5><EFBFBD><EFBFBD> return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><20>ݴ<EFBFBD><DDB4><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>򰥸<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ְڴ<D6B0>..)
#define VERIFY_MSG(exp, msg) \
if (true == (exp)) { \
ChatPacket(CHAT_TYPE_INFO, LC_TEXT(msg)); \
return false; \
}
/// <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>־<EFBFBD><D6BE><EFBFBD> item<65><6D> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><> Ȯ<><C8AE><EFBFBD>ϰ<EFBFBD>, <20>Ұ<EFBFBD><D2B0><EFBFBD> <20>ϴٸ<CFB4> ij<><C4B3><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˷<EFBFBD><CBB7>ִ<EFBFBD> <20>Լ<EFBFBD>
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;
}
for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)
{
int limit = itemTable->aLimits[i].lValue;
2022-03-05 12:44:06 +02:00
switch (itemTable->aLimits[i].bType)
{
case LIMIT_LEVEL:
if (GetLevel() < limit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
break;
case LIMIT_STR:
if (GetPoint(POINT_ST) < limit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>ٷ<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
break;
case LIMIT_INT:
if (GetPoint(POINT_IQ) < limit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
break;
case LIMIT_DEX:
if (GetPoint(POINT_DX) < limit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
break;
case LIMIT_CON:
if (GetPoint(POINT_HT) < limit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ü<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ũ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ÿ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
if (marriage::CManager::instance().IsMarriageUniqueItem(item->GetVnum()) &&
!marriage::CManager::instance().IsMarried(GetPlayerID()))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>¿<EFBFBD><C2BF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return false;
}
}
return true;
}
/// <20><><EFBFBD><EFBFBD> ij<><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>¸<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> item<65><6D> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><> Ȯ<><C8AE><EFBFBD>ϰ<EFBFBD>, <20>Ұ<EFBFBD><D2B0><EFBFBD> <20>ϴٸ<CFB4> ij<><C4B3><EFBFBD>Ϳ<EFBFBD><CDBF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>˷<EFBFBD><CBB7>ִ<EFBFBD> <20>Լ<EFBFBD>
bool CHARACTER::CanUnequipNow(const LPITEM item, const TItemPos& srcCell, const TItemPos& destCell) /*const*/
{
if (ITEM_BELT == item->GetType())
VERIFY_MSG(CBeltInventoryHelper::IsExistItemInBeltInventory(this), "<EFBFBD><EFBFBD>Ʈ <20>κ<EFBFBD><CEBA><EFBFBD><E4B8AE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>.");
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (IS_SET(item->GetFlag(), ITEM_FLAG_IRREMOVABLE))
return false;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> unequip<69><70> <20>κ<EFBFBD><CEBA><EFBFBD><E4B8AE> <20>ű<EFBFBD> <20><> <20><> <20>ڸ<EFBFBD><DAB8><EFBFBD> <20>ִ<EFBFBD> <20><> Ȯ<><C8AE>
{
int pos = -1;
if (item->IsDragonSoul())
pos = GetEmptyDragonSoulInventory(item);
else
pos = GetEmptyInventory(item->GetSize());
VERIFY_MSG( -1 == pos, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>." );
}
return true;
}