Applied changes on the game executable.

This commit is contained in:
2023-12-30 22:15:54 +02:00
parent 2c8cb0c857
commit 2f829ae2dc
144 changed files with 2547 additions and 3147 deletions

View File

@@ -121,7 +121,7 @@ bool CShopManager::StartShopping(LPCHARACTER pkChr, LPCHARACTER pkChrShopKeeper,
if (distance >= SHOP_MAX_DISTANCE)
{
sys_log(1, "SHOP: TOO_FAR: %s distance %d", pkChr->GetName(), distance);
SPDLOG_DEBUG("SHOP: TOO_FAR: {} distance {}", pkChr->GetName(), distance);
return false;
}
@@ -134,7 +134,7 @@ bool CShopManager::StartShopping(LPCHARACTER pkChr, LPCHARACTER pkChrShopKeeper,
if (!pkShop)
{
sys_log(1, "SHOP: NO SHOP");
SPDLOG_DEBUG("SHOP: NO SHOP");
return false;
}
@@ -145,7 +145,7 @@ bool CShopManager::StartShopping(LPCHARACTER pkChr, LPCHARACTER pkChrShopKeeper,
pkShop->AddGuest(pkChr, pkChrShopKeeper->GetVID(), bOtherEmpire);
pkChr->SetShopOwner(pkChrShopKeeper);
sys_log(0, "SHOP: START: %s", pkChr->GetName());
SPDLOG_DEBUG("SHOP: START: {}", pkChr->GetName());
return true;
}
@@ -200,7 +200,7 @@ void CShopManager::StopShopping(LPCHARACTER ch)
//END_PREVENT_ITEM_COPY
shop->RemoveGuest(ch);
sys_log(0, "SHOP: END: %s", ch->GetName());
SPDLOG_DEBUG("SHOP: END: {}", ch->GetName());
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
@@ -328,20 +328,19 @@ void CShopManager::Sell(LPCHARACTER ch, BYTE bCell, BYTE bCount)
dwPrice -= dwTax;
}
if (test_server)
sys_log(0, "Sell Item price id %d %s itemid %d", ch->GetPlayerID(), ch->GetName(), item->GetID());
SPDLOG_TRACE("Sell Item price id {} {} itemid {}", ch->GetPlayerID(), ch->GetName(), item->GetID());
const int64_t nTotalMoney = static_cast<int64_t>(ch->GetGold()) + static_cast<int64_t>(dwPrice);
if (GOLD_MAX <= nTotalMoney)
{
sys_err("[OVERFLOW_GOLD] id %u name %s gold %u", ch->GetPlayerID(), ch->GetName(), ch->GetGold());
SPDLOG_ERROR("[OVERFLOW_GOLD] id {} name {} gold {}", ch->GetPlayerID(), ch->GetName(), ch->GetGold());
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("20<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʰ<EFBFBD><CAB0>Ͽ<EFBFBD> <20><>ǰ<EFBFBD><C7B0> <20>ȼ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD>."));
return;
}
// 20050802.myevan.<2E><><EFBFBD><EFBFBD> <20>Ǹ<EFBFBD> <20>α׿<CEB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ID <20>߰<EFBFBD>
sys_log(0, "SHOP: SELL: %s item name: %s(x%d):%u price: %u", ch->GetName(), item->GetName(), bCount, item->GetID(), dwPrice);
SPDLOG_DEBUG("SHOP: SELL: {} item name: {}(x{}):{} price: {}", ch->GetName(), item->GetName(), bCount, item->GetID(), dwPrice);
if (iVal > 0)
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<EFBFBD>Ǹűݾ<EFBFBD><EFBFBD><EFBFBD> %d %% <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ե˴ϴ<CBB4>"), iVal);
@@ -380,19 +379,19 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable)
{
if (!pNode->GetValue("vnum", 0, shopTable.dwVnum))
{
sys_err("Group %s does not have vnum.", pNode->GetNodeName().c_str());
SPDLOG_ERROR("Group {} does not have vnum.", pNode->GetNodeName());
return false;
}
if (!pNode->GetValue("name", 0, shopTable.name))
{
sys_err("Group %s does not have name.", pNode->GetNodeName().c_str());
SPDLOG_ERROR("Group {} does not have name.", pNode->GetNodeName());
return false;
}
if (shopTable.name.length() >= SHOP_TAB_NAME_MAX)
{
sys_err("Shop name length must be less than %d. Error in Group %s, name %s", SHOP_TAB_NAME_MAX, pNode->GetNodeName().c_str(), shopTable.name.c_str());
SPDLOG_ERROR("Shop name length must be less than {}. Error in Group {}, name {}", (int) SHOP_TAB_NAME_MAX, pNode->GetNodeName(), shopTable.name);
return false;
}
@@ -412,14 +411,14 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable)
}
else
{
sys_err("Group %s has undefine cointype(%s).", pNode->GetNodeName().c_str(), stCoinType.c_str());
SPDLOG_ERROR("Group {} has undefine cointype({}).", pNode->GetNodeName(), stCoinType);
return false;
}
CGroupNode* pItemGroup = pNode->GetChildNode("items");
if (!pItemGroup)
{
sys_err("Group %s does not have 'group items'.", pNode->GetNodeName().c_str());
SPDLOG_ERROR("Group {} does not have 'group items'.", pNode->GetNodeName());
return false;
}
@@ -427,7 +426,7 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable)
std::vector <TShopItemTable> shopItems(itemGroupSize);
if (itemGroupSize >= SHOP_HOST_ITEM_MAX_NUM)
{
sys_err("count(%d) of rows of group items of group %s must be smaller than %d", itemGroupSize, pNode->GetNodeName().c_str(), SHOP_HOST_ITEM_MAX_NUM);
SPDLOG_ERROR("count({}) of rows of group items of group {} must be smaller than {}", itemGroupSize, pNode->GetNodeName(), (int) SHOP_HOST_ITEM_MAX_NUM);
return false;
}
@@ -435,18 +434,18 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable)
{
if (!pItemGroup->GetValue(i, "vnum", shopItems[i].vnum))
{
sys_err("row(%d) of group items of group %s does not have vnum column", i, pNode->GetNodeName().c_str());
SPDLOG_ERROR("row({}) of group items of group {} does not have vnum column", i, pNode->GetNodeName());
return false;
}
if (!pItemGroup->GetValue(i, "count", shopItems[i].count))
{
sys_err("row(%d) of group items of group %s does not have count column", i, pNode->GetNodeName().c_str());
SPDLOG_ERROR("row({}) of group items of group {} does not have count column", i, pNode->GetNodeName());
return false;
}
if (!pItemGroup->GetValue(i, "price", shopItems[i].price))
{
sys_err("row(%d) of group items of group %s does not have price column", i, pNode->GetNodeName().c_str());
SPDLOG_ERROR("row({}) of group items of group {} does not have price column", i, pNode->GetNodeName());
return false;
}
}
@@ -475,7 +474,7 @@ bool ConvertToShopItemTable(IN CGroupNode* pNode, OUT TShopTableEx& shopTable)
TItemTable * item_table = ITEM_MANAGER::instance().GetTable(shopItems[i].vnum);
if (!item_table)
{
sys_err("vnum(%d) of group items of group %s does not exist", shopItems[i].vnum, pNode->GetNodeName().c_str());
SPDLOG_ERROR("vnum({}) of group items of group {} does not exist", shopItems[i].vnum, pNode->GetNodeName().c_str());
return false;
}
@@ -501,14 +500,14 @@ bool CShopManager::ReadShopTableEx(const char* stFileName)
CGroupTextParseTreeLoader loader;
if (!loader.Load(stFileName))
{
sys_err("%s Load fail.", stFileName);
SPDLOG_ERROR("{} Load fail.", stFileName);
return false;
}
CGroupNode* pShopNPCGroup = loader.GetGroup("shopnpc");
if (NULL == pShopNPCGroup)
{
sys_err("Group ShopNPC is not exist.");
SPDLOG_ERROR("Group ShopNPC is not exist.");
return false;
}
@@ -520,25 +519,25 @@ bool CShopManager::ReadShopTableEx(const char* stFileName)
std::string shopName;
if (!pShopNPCGroup->GetValue(i, "npc", npcVnum) || !pShopNPCGroup->GetValue(i, "group", shopName))
{
sys_err("Invalid row(%d). Group ShopNPC rows must have 'npc', 'group' columns", i);
SPDLOG_ERROR("Invalid row({}). Group ShopNPC rows must have 'npc', 'group' columns", i);
return false;
}
std::transform(shopName.begin(), shopName.end(), shopName.begin(), (int(*)(int))std::tolower);
CGroupNode* pShopGroup = loader.GetGroup(shopName.c_str());
if (!pShopGroup)
{
sys_err("Group %s is not exist.", shopName.c_str());
SPDLOG_ERROR("Group {} is not exist.", shopName.c_str());
return false;
}
TShopTableEx table;
if (!ConvertToShopItemTable(pShopGroup, table))
{
sys_err("Cannot read Group %s.", shopName.c_str());
SPDLOG_ERROR("Cannot read Group {}.", shopName.c_str());
return false;
}
if (m_map_pkShopByNPCVnum.find(npcVnum) != m_map_pkShopByNPCVnum.end())
{
sys_err("%d cannot have both original shop and extended shop", npcVnum);
SPDLOG_ERROR("{} cannot have both original shop and extended shop", npcVnum);
return false;
}
@@ -551,7 +550,7 @@ bool CShopManager::ReadShopTableEx(const char* stFileName)
TShopTableEx& table = it->second;
if (m_map_pkShop.find(table.dwVnum) != m_map_pkShop.end())
{
sys_err("Shop vnum(%d) already exists", table.dwVnum);
SPDLOG_ERROR("Shop vnum({}) already exists", table.dwVnum);
return false;
}
TShopMap::iterator shop_it = m_map_pkShopByNPCVnum.find(npcVnum);
@@ -568,20 +567,20 @@ bool CShopManager::ReadShopTableEx(const char* stFileName)
pkShopEx = dynamic_cast <CShopEx*> (shop_it->second);
if (NULL == pkShopEx)
{
sys_err("WTF!!! It can't be happend. NPC(%d) Shop is not extended version.", shop_it->first);
SPDLOG_ERROR("WTF!!! It can't be happend. NPC({}) Shop is not extended version.", shop_it->first);
return false;
}
}
if (pkShopEx->GetTabCount() >= SHOP_TAB_COUNT_MAX)
{
sys_err("ShopEx cannot have tab more than %d", SHOP_TAB_COUNT_MAX);
SPDLOG_ERROR("ShopEx cannot have tab more than {}", (int) SHOP_TAB_COUNT_MAX);
return false;
}
if (pkShopEx->GetVnum() != 0 && m_map_pkShop.find(pkShopEx->GetVnum()) != m_map_pkShop.end())
{
sys_err("Shop vnum(%d) already exist.", pkShopEx->GetVnum());
SPDLOG_ERROR("Shop vnum({}) already exist.", pkShopEx->GetVnum());
return false;
}
m_map_pkShop.insert(TShopMap::value_type (pkShopEx->GetVnum(), pkShopEx));