Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#include "stdafx.h"
|
||||
#include "Commands.h"
|
||||
#include <Creature/CreatureManager.h>
|
||||
#include <Creature/Character/Character.h>
|
||||
#include <Map/FieldMap/Cell.h>
|
||||
#include <Item/ItemFactory.h>
|
||||
|
||||
|
||||
CConsoleCommand* CCMDDropItem::Clone(const char* szCommand, size_t nCommandLength)
|
||||
{
|
||||
const int MAX_BUFFER = 256;
|
||||
char szBuffer[MAX_BUFFER + 1];
|
||||
|
||||
const char* szDelimiter = " \t\r\n";
|
||||
|
||||
_snprintf(szBuffer, MAX_BUFFER, "%s", szCommand);
|
||||
szBuffer[MAX_BUFFER] = '\0';
|
||||
|
||||
char* token = strtok(szBuffer, szDelimiter);
|
||||
|
||||
CCMDDropItem* lpCMD = new CCMDDropItem;
|
||||
if (NULL != lpCMD)
|
||||
{
|
||||
token = strtok(NULL, szDelimiter);
|
||||
_snprintf(lpCMD->m_szName, MAX_NAME, "%s", token);
|
||||
lpCMD->m_szName[MAX_NAME] = '\0';
|
||||
|
||||
token = strtok(NULL, szDelimiter);
|
||||
lpCMD->m_usItemProtoTypeID = (NULL == token) ? 0 : atoi(token);
|
||||
}
|
||||
|
||||
return lpCMD;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CCMDDropItem::DoProcess()
|
||||
{
|
||||
CCharacter* lpCharacter = CCreatureManager::GetInstance().GetCharacter(m_szName);
|
||||
if (NULL != lpCharacter)
|
||||
{
|
||||
Item::CItem* lpItem = Item::CItemFactory::GetInstance().CreateItem(m_usItemProtoTypeID);
|
||||
if (NULL != lpItem)
|
||||
{
|
||||
if (false == lpCharacter->GiveItem(lpItem))
|
||||
{
|
||||
DELETE_ITEM(lpItem);
|
||||
}
|
||||
|
||||
// GievItem <20><><EFBFBD><EFBFBD> <20><><EFBFBD>õ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
if (NULL != lpItem)
|
||||
{
|
||||
if (lpItem->IsSet(Item::DetailData::STACKABLE) && 0 == lpItem->GetNumOrDurability())
|
||||
{
|
||||
DELETE_ITEM(lpItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user