- Mesaj
- 309
- Çözümler
- 7
- Beğeni
- 94
- Puan
- 724
- Ticaret Puanı
- 0
Arkadaşlar şu kodu nereye ekliceğimi bilemedim bakabilirmisiniz. Kaçıncı satıra eklemem gerekiyor?
Benim dosyam :
eklemem gereken:
Benim dosyam :
C++:
#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"
#include "../../common/VnumHelper.h"
#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;
#define ERROR_MSG(exp, msg) \
if(true==(exp)) \
{ \
ChatPacket(CHAT_TYPE_INFO, msg); \
return false; \
} \
// CHANGE_ITEM_ATTRIBUTES
const DWORD CHARACTER::msc_dwDefaultChangeItemAttrCycle = 10;
const char CHARACTER::msc_szLastChangeItemAttrFlag[] = "Item.LastChangeItemAttr";
const char CHARACTER::msc_szChangeItemAttrCycleFlag[] = "change_itemattr_cycle";
// END_OF_CHANGE_ITEM_ATTRIBUTES
const BYTE g_aBuffOnAttrPoints[] = { POINT_ENERGY, POINT_COSTUME_ATTR_BONUS };
struct FFindStone
{
std::map<DWORD, LPCHARACTER> m_mapStone;
void operator()(LPENTITY pEnt)
{
if (pEnt->IsType(ENTITY_CHARACTER) == true)
{
LPCHARACTER pChar = (LPCHARACTER)pEnt;
if (pChar->IsStone() == true)
{
m_mapStone[(DWORD)pChar->GetVID()] = pChar;
}
}
}
};
//귀환부, 귀환기억부, 결혼반지
static bool IS_SUMMON_ITEM(int vnum)
{
switch (vnum)
{
case 22000:
case 22010:
case 22011:
case 22020:
case ITEM_MARRIAGE_RING:
return true;
}
return false;
}
static bool IS_MONKEY_DUNGEON(int map_index)
{
switch (map_index)
{
case 5:
case 25:
case 45:
case 108:
case 109:
return true;;
}
return false;
}
bool IS_SUMMONABLE_ZONE(int map_index)
{
// 몽키던전
if (IS_MONKEY_DUNGEON(map_index))
return false;
// 성
if (IS_CASTLE_MAP(map_index))
return false;
switch (map_index)
{
case 66 : // 사귀타워
case 71 : // 거미 던전 2층
case 72 : // 천의 동굴
case 73 : // 천의 동굴 2층
case 193 : // 거미 던전 2-1층
#if 0
case 184 : // 천의 동굴(신수)
case 185 : // 천의 동굴 2층(신수)
case 186 : // 천의 동굴(천조)
case 187 : // 천의 동굴 2층(천조)
case 188 : // 천의 동굴(진노)
case 189 : // 천의 동굴 2층(진노)
#endif
// case 206 : // 아귀동굴
case 216 : // 아귀동굴
case 217 : // 거미 던전 3층
case 208 : // 천의 동굴 (용방)
return false;
}
if (CBattleArena::IsBattleArenaMap(map_index)) return false;
// 모든 private 맵으론 워프 불가능
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 이 프로토타입과 같은지 체크 -- 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 복사 -- by mhh
static void FN_copy_item_socket(LPITEM dest, LPITEM src)
{
for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
{
dest->SetSocket(i, src->GetSocket(i));
}
}
static bool FN_check_item_sex(LPCHARACTER ch, LPITEM item)
{
// 남자 금지
if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_MALE))
{
if (SEX_MALE==GET_SEX(ch))
return false;
}
// 여자금지
if (IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_FEMALE))
{
if (SEX_FEMALE==GET_SEX(ch))
return false;
}
return true;
}
/////////////////////////////////////////////////////////////////////////////
// ITEM HANDLING
/////////////////////////////////////////////////////////////////////////////
bool CHARACTER::CanHandleItem(bool bSkipCheckRefine, bool bSkipObserver)
{
if (!bSkipObserver)
if (m_bIsObserver)
return false;
if (GetMyShop())
return false;
if (!bSkipCheckRefine)
if (m_bUnderRefine)
return false;
if (IsCubeOpen() || NULL != DragonSoul_RefineWindow_GetOpener())
return false;
if (IsWarping())
return false;
return true;
}
LPITEM CHARACTER::GetInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(INVENTORY, wCell));
}
#ifdef UK_ENABLE_SPECIAL_STORAGE
LPITEM CHARACTER::GetUpgradeInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(UPGRADE_INVENTORY, wCell));
}
LPITEM CHARACTER::GetBookInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(BOOK_INVENTORY, wCell));
}
LPITEM CHARACTER::GetStoneInventoryItem(WORD wCell) const
{
return GetItem(TItemPos(STONE_INVENTORY, wCell));
}
#endif
LPITEM CHARACTER::GetItem(TItemPos Cell) const
{
if (!IsValidItemPosition(Cell))
return NULL;
WORD wCell = Cell.cell;
BYTE window_type = Cell.window_type;
switch (window_type)
{
case INVENTORY:
case EQUIPMENT:
if (wCell >= INVENTORY_AND_EQUIP_SLOT_MAX)
{
sys_err("CHARACTER::GetInventoryItem: invalid item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pItems[wCell];
case DRAGON_SOUL_INVENTORY:
if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid DS item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pDSItems[wCell];
#ifdef UK_ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSU item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pSSUItems[wCell];
case BOOK_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSB item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pSSBItems[wCell];
case STONE_INVENTORY:
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::GetInventoryItem: invalid SSS item cell %d", wCell);
return NULL;
}
return m_pointsInstant.pSSSItems[wCell];
#endif
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;
}
// 기본 인벤토리
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 로 하는 것은 빈곳을 체크할 때 같은
// 아이템은 예외처리하기 위함
m_pointsInstant.bItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.bItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pItems[wCell] = pItem;
}
break;
// 용혼석 인벤토리
case DRAGON_SOUL_INVENTORY:
{
LPITEM pOld = m_pointsInstant.pDSItems[wCell];
if (pOld)
{
if (wCell < DRAGON_SOUL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pOld->GetSize(); ++i)
{
int p = wCell + (i * DRAGON_SOUL_BOX_COLUMN_NUM);
if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM)
continue;
if (m_pointsInstant.pDSItems[p] && m_pointsInstant.pDSItems[p] != pOld)
continue;
m_pointsInstant.wDSItemGrid[p] = 0;
}
}
else
m_pointsInstant.wDSItemGrid[wCell] = 0;
}
if (pItem)
{
if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::SetItem: invalid DS item cell %d", wCell);
return;
}
if (wCell < DRAGON_SOUL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pItem->GetSize(); ++i)
{
int p = wCell + (i * DRAGON_SOUL_BOX_COLUMN_NUM);
if (p >= DRAGON_SOUL_INVENTORY_MAX_NUM)
continue;
// wCell + 1 로 하는 것은 빈곳을 체크할 때 같은
// 아이템은 예외처리하기 위함
m_pointsInstant.wDSItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.wDSItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pDSItems[wCell] = pItem;
}
break;
#ifdef UK_ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
{
LPITEM pOld = m_pointsInstant.pSSUItems[wCell];
if (pOld)
{
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pOld->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
if (m_pointsInstant.pSSUItems[p] && m_pointsInstant.pSSUItems[p] != pOld)
continue;
m_pointsInstant.wSSUItemGrid[p] = 0;
}
}
else
m_pointsInstant.wSSUItemGrid[wCell] = 0;
}
if (pItem)
{
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::SetItem: invalid SSU item cell %d", wCell);
return;
}
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pItem->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
m_pointsInstant.wSSUItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.wSSUItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pSSUItems[wCell] = pItem;
}
break;
case BOOK_INVENTORY:
{
LPITEM pOld = m_pointsInstant.pSSBItems[wCell];
if (pOld)
{
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pOld->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
if (m_pointsInstant.pSSBItems[p] && m_pointsInstant.pSSBItems[p] != pOld)
continue;
m_pointsInstant.wSSBItemGrid[p] = 0;
}
}
else
m_pointsInstant.wSSBItemGrid[wCell] = 0;
}
if (pItem)
{
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::SetItem: invalid SSB item cell %d", wCell);
return;
}
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pItem->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
m_pointsInstant.wSSBItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.wSSBItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pSSBItems[wCell] = pItem;
}
break;
case STONE_INVENTORY:
{
LPITEM pOld = m_pointsInstant.pSSSItems[wCell];
if (pOld)
{
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pOld->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
if (m_pointsInstant.pSSSItems[p] && m_pointsInstant.pSSSItems[p] != pOld)
continue;
m_pointsInstant.wSSSItemGrid[p] = 0;
}
}
else
m_pointsInstant.wSSSItemGrid[wCell] = 0;
}
if (pItem)
{
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
{
sys_err("CHARACTER::SetItem: invalid SSB item cell %d", wCell);
return;
}
if (wCell < SPECIAL_INVENTORY_MAX_NUM)
{
for (int i = 0; i < pItem->GetSize(); ++i)
{
int p = wCell + (i * 5);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
continue;
m_pointsInstant.wSSSItemGrid[p] = wCell + 1;
}
}
else
m_pointsInstant.wSSSItemGrid[wCell] = wCell + 1;
}
m_pointsInstant.pSSSItems[wCell] = pItem;
}
break;
#endif
default:
sys_err ("Invalid Inventory type %d", window_type);
return;
}
if (GetDesc())
{
// 확장 아이템: 서버에서 아이템 플래그 정보를 보낸다
if (pItem)
{
TPacketGCItemSet pack;
pack.header = HEADER_GC_ITEM_SET;
pack.Cell = Cell;
pack.count = pItem->GetCount();
pack.vnum = pItem->GetVnum();
pack.flags = pItem->GetFlag();
pack.anti_flags = pItem->GetAntiFlag();
pack.highlight = (Cell.window_type == DRAGON_SOUL_INVENTORY);
thecore_memcpy(pack.alSockets, pItem->GetSockets(), sizeof(pack.alSockets));
thecore_memcpy(pack.aAttr, pItem->GetAttributes(), sizeof(pack.aAttr));
GetDesc()->Packet(&pack, sizeof(TPacketGCItemSet));
}
else
{
TPacketGCItemDelDeprecated pack;
pack.header = HEADER_GC_ITEM_DEL;
pack.Cell = Cell;
pack.count = 0;
pack.vnum = 0;
memset(pack.alSockets, 0, sizeof(pack.alSockets));
memset(pack.aAttr, 0, sizeof(pack.aAttr));
GetDesc()->Packet(&pack, sizeof(TPacketGCItemDelDeprecated));
}
}
if (pItem)
{
pItem->SetCell(this, wCell);
switch (window_type)
{
case INVENTORY:
case EQUIPMENT:
if ((wCell < INVENTORY_MAX_NUM) || (BELT_INVENTORY_SLOT_START <= wCell && BELT_INVENTORY_SLOT_END > wCell))
pItem->SetWindow(INVENTORY);
else
pItem->SetWindow(EQUIPMENT);
break;
case DRAGON_SOUL_INVENTORY:
pItem->SetWindow(DRAGON_SOUL_INVENTORY);
break;
#ifdef UK_ENABLE_SPECIAL_STORAGE
case UPGRADE_INVENTORY:
pItem->SetWindow(UPGRADE_INVENTORY);
break;
case BOOK_INVENTORY:
pItem->SetWindow(BOOK_INVENTORY);
break;
case STONE_INVENTORY:
pItem->SetWindow(STONE_INVENTORY);
break;
#endif
}
}
}
LPITEM CHARACTER::GetWear(BYTE bCell) const
{
// > WEAR_MAX_NUM : 용혼석 슬롯들.
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 : 용혼석 슬롯들.
if (bCell >= WEAR_MAX_NUM + DRAGON_SOUL_DECK_MAX_NUM * DS_SLOT_MAX)
{
sys_err("CHARACTER::SetItem: invalid item cell %d", bCell);
return;
}
SetItem(TItemPos (INVENTORY, INVENTORY_MAX_NUM + bCell), item);
if (!item && bCell == WEAR_WEAPON)
{
// 귀검 사용 시 벗는 것이라면 효과를 없애야 한다.
if (IsAffectFlag(AFF_GWIGUM))
RemoveAffect(SKILL_GWIGEOM);
if (IsAffectFlag(AFF_GEOMGYEONG))
RemoveAffect(SKILL_GEOMKYUNG);
}
}
void CHARACTER::ClearItem()
{
int i;
LPITEM item;
for (i = 0; i < INVENTORY_AND_EQUIP_SLOT_MAX; ++i)
{
if ((item = GetInventoryItem(i)))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
SyncQuickslot(QUICKSLOT_TYPE_ITEM, i, 255);
}
}
for (i = 0; i < DRAGON_SOUL_INVENTORY_MAX_NUM; ++i)
{
if ((item = GetItem(TItemPos(DRAGON_SOUL_INVENTORY, i))))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
}
}
#ifdef UK_ENABLE_SPECIAL_STORAGE
for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if ((item = GetItem(TItemPos(UPGRADE_INVENTORY, i))))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
}
}
for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if ((item = GetItem(TItemPos(BOOK_INVENTORY, i))))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
}
}
for (i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i)
{
if ((item = GetItem(TItemPos(STONE_INVENTORY, i))))
{
item->SetSkipSave(true);
ITEM_MANAGER::instance().FlushDelayedSave(item);
item->RemoveFromCharacter();
M2_DESTROY_ITEM(item);
}
}
#endif
}
bool CHARACTER::IsEmptyItemGrid(TItemPos Cell, BYTE bSize, int iExceptionCell) const
{
switch (Cell.window_type)
{
case INVENTORY:
{
BYTE bCell = Cell.cell;
// bItemCell은 0이 false임을 나타내기 위해 + 1 해서 처리한다.
// 따라서 iExceptionCell에 1을 더해 비교한다.
++iExceptionCell;
if (Cell.IsBeltInventoryPosition())
{
LPITEM beltItem = GetWear(WEAR_BELT);
if (NULL == beltItem)
return false;
if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0)))
return false;
if (m_pointsInstant.bItemGrid[bCell])
{
if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell)
return true;
return false;
}
if (bSize == 1)
return true;
}
else if (bCell >= INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.bItemGrid[bCell])
{
if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
BYTE bPage = bCell / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT);
do
{
BYTE p = bCell + (5 * j);
if (p >= INVENTORY_MAX_NUM)
return false;
if (p / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT) != bPage)
return false;
if (m_pointsInstant.bItemGrid[p])
if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
else
return false;
}
// 크기가 1이면 한칸을 차지하는 것이므로 그냥 리턴
if (1 == bSize)
return true;
else
{
int j = 1;
BYTE bPage = bCell / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT);
do
{
BYTE p = bCell + (5 * j);
if (p >= INVENTORY_MAX_NUM)
return false;
if (p / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT) != bPage)
return false;
if (m_pointsInstant.bItemGrid[p])
if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
break;
case DRAGON_SOUL_INVENTORY:
{
WORD wCell = Cell.cell;
if (wCell >= DRAGON_SOUL_INVENTORY_MAX_NUM)
return false;
// bItemCell은 0이 false임을 나타내기 위해 + 1 해서 처리한다.
// 따라서 iExceptionCell에 1을 더해 비교한다.
iExceptionCell++;
if (m_pointsInstant.wDSItemGrid[wCell])
{
if (m_pointsInstant.wDSItemGrid[wCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
do
{
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이면 한칸을 차지하는 것이므로 그냥 리턴
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;
}
}
}
}
int CHARACTER::GetEmptyInventory(BYTE size) const
{
// NOTE: 현재 이 함수는 아이템 지급, 획득 등의 행위를 할 때 인벤토리의 빈 칸을 찾기 위해 사용되고 있는데,
// 벨트 인벤토리는 특수 인벤토리이므로 검사하지 않도록 한다. (기본 인벤토리: INVENTORY_MAX_NUM 까지만 검사)
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
{
// 여기서 깨진석이 자동적으로 청소 됨
for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
{
if (!pkOldItem->GetSocket(i))
break;
else
pkNewItem->SetSocket(i, 1);
}
// 소켓 설정
int slot = 0;
for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
{
long socket = pkOldItem->GetSocket(i);
if (socket > 2 && socket != ITEM_BROKEN_METIN_VNUM)
pkNewItem->SetSocket(slot++, socket);
}
}
// 매직 아이템 설정
pkOldItem->CopyAttributeTo(pkNewItem);
}
void NotifyRefineSuccess(LPCHARACTER ch, LPITEM item, const char* way)
{
if (NULL != ch && item != NULL)
{
ch->ChatPacket(CHAT_TYPE_COMMAND, "RefineSuceeded");
LogManager::instance().RefineLog(ch->GetPlayerID(), item->GetName(), item->GetID(), item->GetRefineLevel(), 1, way);
}
}
void NotifyRefineFail(LPCHARACTER ch, LPITEM item, const char* way, int success = 0)
{
if (NULL != ch && NULL != item)
{
ch->ChatPacket(CHAT_TYPE_COMMAND, "RefineFailed");
LogManager::instance().RefineLog(ch->GetPlayerID(), item->GetName(), item->GetID(), item->GetRefineLevel(), success, way);
}
}
void CHARACTER::SetRefineNPC(LPCHARACTER ch)
{
if ( ch != NULL )
{
m_dwRefineNPCVID = ch->GetVID();
}
else
{
m_dwRefineNPCVID = 0;
}
}
bool CHARACTER::DoRefine(LPITEM item, bool bMoneyOnly)
{
if (item->GetType() == ITEM_METIN)
{
if (item->GetCount() > 1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("tas_basma_blok"));
return false;
}
}
if (!CanHandleItem(true))
{
ClearRefineMode();
return false;
}
//개량 시간제한 : upgrade_refine_scroll.quest 에서 개량후 5분이내에 일반 개량을
//진행할수 없음
if (quest::CQuestManager::instance().GetEventFlag("update_refine_time") != 0)
{
if (get_global_time() < quest::CQuestManager::instance().GetEventFlag("update_refine_time") + (60 * 5))
{
sys_log(0, "can't refine %d %s", GetPlayerID(), GetName());
return false;
}
}
const TRefineTable * prt = CRefineManager::instance().GetRefineRecipe(item->GetRefineSet());
if (!prt)
return false;
DWORD result_vnum = item->GetRefinedVnum();
// REFINE_COST
int cost = ComputeRefineFee(prt->cost);
int RefineChance = GetQuestFlag("main_quest_lv7.refine_chance");
if (RefineChance > 0)
{
if (!item->CheckItemUseLevel(20) || item->GetType() != ITEM_WEAPON)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("무료 개량 기회는 20 이하의 무기만 가능합니다"));
return false;
}
cost = 0;
SetQuestFlag("main_quest_lv7.refine_chance", RefineChance - 1);
}
// END_OF_REFINE_COST
if (result_vnum == 0)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("더 이상 개량할 수 없습니다."));
return false;
}
if (item->GetType() == ITEM_USE && item->GetSubType() == USE_TUNING)
return false;
TItemTable * pProto = ITEM_MANAGER::instance().GetTable(item->GetRefinedVnum());
if (!pProto)
{
sys_err("DoRefine NOT GET ITEM PROTO %d", item->GetRefinedVnum());
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이 아이템은 개량할 수 없습니다."));
return false;
}
// Check level limit in korea only
if (!g_iUseLocale)
{
for (int i = 0; i < ITEM_LIMIT_MAX_NUM; ++i)
{
long limit = pProto->aLimits[i].lValue;
switch (pProto->aLimits[i].bType)
{
case LIMIT_LEVEL:
if (GetLevel() < limit)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("개량된 후 아이템의 레벨 제한보다 레벨이 낮습니다."));
return false;
}
break;
}
}
}
eklemem gereken:
C++:
//6. Search: function ( bool CHARACTER::IsEmptyItemGrid ) **********************************************************************************
if (m_pointsInstant.bItemGrid[p])
if (m_pointsInstant.wDSItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
//6. Add after:
#ifdef UK_ENABLE_SPECIAL_STORAGE
break;
case UPGRADE_INVENTORY:
{
WORD wCell = Cell.cell;
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
return false;
iExceptionCell++;
if (m_pointsInstant.wSSUItemGrid[wCell])
{
if (m_pointsInstant.wSSUItemGrid[wCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.wSSUItemGrid[p])
if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
else
return false;
}
if (1 == bSize)
return true;
else
{
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
if (m_pointsInstant.wSSUItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
break;
case BOOK_INVENTORY:
{
WORD wCell = Cell.cell;
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
return false;
iExceptionCell++;
if (m_pointsInstant.wSSBItemGrid[wCell])
{
if (m_pointsInstant.wSSBItemGrid[wCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.wSSBItemGrid[p])
if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
else
return false;
}
if (1 == bSize)
return true;
else
{
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
if (m_pointsInstant.wSSBItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
case STONE_INVENTORY:
{
WORD wCell = Cell.cell;
if (wCell >= SPECIAL_INVENTORY_MAX_NUM)
return false;
iExceptionCell++;
if (m_pointsInstant.wSSSItemGrid[wCell])
{
if (m_pointsInstant.wSSSItemGrid[wCell] == iExceptionCell)
{
if (bSize == 1)
return true;
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.wSSSItemGrid[p])
if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
else
return false;
}
if (1 == bSize)
return true;
else
{
int j = 1;
do
{
int p = wCell + (5 * j);
if (p >= SPECIAL_INVENTORY_MAX_NUM)
return false;
if (m_pointsInstant.bItemGrid[p]) // old bItemGrid
if (m_pointsInstant.wSSSItemGrid[p] != iExceptionCell)
return false;
}
while (++j < bSize);
return true;
}
}
#endif