mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Apply style fix pt2
This commit is contained in:
parent
35405dd549
commit
1392c131e7
77 changed files with 1318 additions and 817 deletions
|
|
@ -828,7 +828,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
||||||
{
|
{
|
||||||
Chance = MaxChance - (ratio * (MaxChance / 10));
|
Chance = MaxChance - (ratio * (MaxChance / 10));
|
||||||
}
|
}
|
||||||
else { Chance = 1; }
|
else
|
||||||
|
{
|
||||||
|
Chance = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -847,7 +850,10 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
||||||
{
|
{
|
||||||
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
|
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
|
||||||
}
|
}
|
||||||
else { Chance = 1; }
|
else
|
||||||
|
{
|
||||||
|
Chance = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -862,9 +868,15 @@ bool AuctionBotBuyer::IsBuyableEntry(uint64 buyoutPrice, double InGame_BuyPrice,
|
||||||
{
|
{
|
||||||
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
|
Chance = (MaxChance / 5) - (ratio * (MaxChance / 50));
|
||||||
}
|
}
|
||||||
else { Chance = 0; }
|
else
|
||||||
|
{
|
||||||
|
Chance = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Chance = 0;
|
||||||
}
|
}
|
||||||
else { Chance = 0; }
|
|
||||||
}
|
}
|
||||||
uint32 RandNum = urand(1, ChanceRatio);
|
uint32 RandNum = urand(1, ChanceRatio);
|
||||||
if (RandNum <= Chance)
|
if (RandNum <= Chance)
|
||||||
|
|
@ -1056,8 +1068,14 @@ void AuctionBotBuyer::addNewAuctionBuyerBotBid(AHB_Buyer_Config& config)
|
||||||
if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, minBuyPrice, MaxChance, config.FactionChance))
|
if (IsBuyableEntry(buyoutPrice, InGame_BuyPrice, MaxBuyablePrice, minBuyPrice, MaxChance, config.FactionChance))
|
||||||
{
|
{
|
||||||
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, minBidPrice, MaxChance / 2, config.FactionChance))
|
if (IsBidableEntry(bidPriceByItem, InGame_BuyPrice, MaxBidablePrice, minBidPrice, MaxChance / 2, config.FactionChance))
|
||||||
if (urand(0, 5) == 0) { PlaceBidToEntry(auction, bidPrice); }
|
if (urand(0, 5) == 0)
|
||||||
else { BuyEntry(auction); }
|
{
|
||||||
|
PlaceBidToEntry(auction, bidPrice);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuyEntry(auction);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ BuyEntry(auction); }
|
{ BuyEntry(auction); }
|
||||||
}
|
}
|
||||||
|
|
@ -1093,7 +1111,10 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else { return false; }
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//== AuctionBotSeller functions ============================
|
//== AuctionBotSeller functions ============================
|
||||||
|
|
@ -1898,7 +1919,10 @@ void AuctionBotSeller::addNewAuctions(AHB_Seller_Config& config)
|
||||||
items = sAuctionBotConfig.GetItemPerCycleBoost();
|
items = sAuctionBotConfig.GetItemPerCycleBoost();
|
||||||
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used to fill AH! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
|
BASIC_FILTER_LOG(LOG_FILTER_AHBOT_BUYER, "AHBot: Boost value used to fill AH! (if this happens often adjust both ItemsPerCycle in ahbot.conf)");
|
||||||
}
|
}
|
||||||
else { items = sAuctionBotConfig.GetItemPerCycleNormal(); }
|
else
|
||||||
|
{
|
||||||
|
items = sAuctionBotConfig.GetItemPerCycleNormal();
|
||||||
|
}
|
||||||
|
|
||||||
uint32 houseid;
|
uint32 houseid;
|
||||||
switch (config.GetHouseType())
|
switch (config.GetHouseType())
|
||||||
|
|
|
||||||
|
|
@ -607,7 +607,10 @@ void BattleGround::SendPacketToTeam(Team teamId, WorldPacket* packet, Player* se
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = itr->second.PlayerTeam;
|
Team team = itr->second.PlayerTeam;
|
||||||
if (!team) { team = plr->GetTeam(); }
|
if (!team)
|
||||||
|
{
|
||||||
|
team = plr->GetTeam();
|
||||||
|
}
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
{
|
{
|
||||||
|
|
@ -651,7 +654,10 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, Team teamId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = itr->second.PlayerTeam;
|
Team team = itr->second.PlayerTeam;
|
||||||
if (!team) { team = plr->GetTeam(); }
|
if (!team)
|
||||||
|
{
|
||||||
|
team = plr->GetTeam();
|
||||||
|
}
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
{
|
{
|
||||||
|
|
@ -684,7 +690,10 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, Team teamId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = itr->second.PlayerTeam;
|
Team team = itr->second.PlayerTeam;
|
||||||
if (!team) { team = plr->GetTeam(); }
|
if (!team)
|
||||||
|
{
|
||||||
|
team = plr->GetTeam();
|
||||||
|
}
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
{
|
{
|
||||||
|
|
@ -716,7 +725,10 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, Team teamId)
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = itr->second.PlayerTeam;
|
Team team = itr->second.PlayerTeam;
|
||||||
if (!team) { team = plr->GetTeam(); }
|
if (!team)
|
||||||
|
{
|
||||||
|
team = plr->GetTeam();
|
||||||
|
}
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
{
|
{
|
||||||
|
|
@ -756,7 +768,10 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
||||||
}
|
}
|
||||||
|
|
||||||
Team team = itr->second.PlayerTeam;
|
Team team = itr->second.PlayerTeam;
|
||||||
if (!team) { team = plr->GetTeam(); }
|
if (!team)
|
||||||
|
{
|
||||||
|
team = plr->GetTeam();
|
||||||
|
}
|
||||||
|
|
||||||
if (team == teamId)
|
if (team == teamId)
|
||||||
{
|
{
|
||||||
|
|
@ -1286,7 +1301,10 @@ void BattleGround::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
|
||||||
{
|
{
|
||||||
plr->ClearAfkReports();
|
plr->ClearAfkReports();
|
||||||
|
|
||||||
if (!team) { team = plr->GetTeam(); }
|
if (!team)
|
||||||
|
{
|
||||||
|
team = plr->GetTeam();
|
||||||
|
}
|
||||||
|
|
||||||
// if arena, remove the specific arena auras
|
// if arena, remove the specific arena auras
|
||||||
if (isArena())
|
if (isArena())
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,10 @@ bool ChatHandler::HandleGPSCommand(char* args)
|
||||||
else
|
else
|
||||||
{ PSendSysMessage("You are INdoor"); }
|
{ PSendSysMessage("You are INdoor"); }
|
||||||
}
|
}
|
||||||
else { PSendSysMessage("no VMAP available for area info"); }
|
else
|
||||||
|
{
|
||||||
|
PSendSysMessage("no VMAP available for area info");
|
||||||
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_MAP_POSITION,
|
PSendSysMessage(LANG_MAP_POSITION,
|
||||||
obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"),
|
obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"),
|
||||||
|
|
|
||||||
|
|
@ -5464,7 +5464,10 @@ bool ChatHandler::HandleListAurasCommand(char* /*args*/)
|
||||||
for (int i = 0; i < TOTAL_AURAS; ++i)
|
for (int i = 0; i < TOTAL_AURAS; ++i)
|
||||||
{
|
{
|
||||||
Unit::AuraList const& uAuraList = unit->GetAurasByType(AuraType(i));
|
Unit::AuraList const& uAuraList = unit->GetAurasByType(AuraType(i));
|
||||||
if (uAuraList.empty()) { continue; }
|
if (uAuraList.empty())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
|
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
|
||||||
for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
|
for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
@ -7226,7 +7229,10 @@ bool ChatHandler::HandleCastSelfCommand(char* args)
|
||||||
bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/)
|
bool ChatHandler::HandleInstanceListBindsCommand(char* /*args*/)
|
||||||
{
|
{
|
||||||
Player* player = getSelectedPlayer();
|
Player* player = getSelectedPlayer();
|
||||||
if (!player) { player = m_session->GetPlayer(); }
|
if (!player)
|
||||||
|
{
|
||||||
|
player = m_session->GetPlayer();
|
||||||
|
}
|
||||||
uint32 counter = 0;
|
uint32 counter = 0;
|
||||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -447,7 +447,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
Player* player = getSelectedPlayer();
|
Player* player = getSelectedPlayer();
|
||||||
if (!player) { player = m_session->GetPlayer(); }
|
if (!player)
|
||||||
|
{
|
||||||
|
player = m_session->GetPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
if (!list_queue && !check_all)
|
if (!list_queue && !check_all)
|
||||||
{
|
{
|
||||||
|
|
@ -461,7 +464,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||||
if (!item) { continue; }
|
if (!item)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!item->IsBag())
|
if (!item->IsBag())
|
||||||
{
|
{
|
||||||
if (item->GetState() == state)
|
if (item->GetState() == state)
|
||||||
|
|
@ -489,7 +495,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
for (size_t i = 0; i < updateQueue.size(); ++i)
|
for (size_t i = 0; i < updateQueue.size(); ++i)
|
||||||
{
|
{
|
||||||
Item* item = updateQueue[i];
|
Item* item = updateQueue[i];
|
||||||
if (!item) { continue; }
|
if (!item)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Bag* container = item->GetContainer();
|
Bag* container = item->GetContainer();
|
||||||
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
|
uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0);
|
||||||
|
|
@ -524,7 +533,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||||
if (!item) { continue; }
|
if (!item)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item->GetSlot() != i)
|
if (item->GetSlot() != i)
|
||||||
{
|
{
|
||||||
|
|
@ -587,7 +599,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
|
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
|
||||||
{
|
{
|
||||||
Item* item2 = bag->GetItemByPos(j);
|
Item* item2 = bag->GetItemByPos(j);
|
||||||
if (!item2) { continue; }
|
if (!item2)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item2->GetSlot() != j)
|
if (item2->GetSlot() != j)
|
||||||
{
|
{
|
||||||
|
|
@ -658,7 +673,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
for (size_t i = 0; i < updateQueue.size(); ++i)
|
for (size_t i = 0; i < updateQueue.size(); ++i)
|
||||||
{
|
{
|
||||||
Item* item = updateQueue[i];
|
Item* item = updateQueue[i];
|
||||||
if (!item) { continue; }
|
if (!item)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (item->GetOwnerGuid() != player->GetObjectGuid())
|
if (item->GetOwnerGuid() != player->GetObjectGuid())
|
||||||
{
|
{
|
||||||
|
|
@ -675,7 +693,10 @@ bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||||
error = true; continue;
|
error = true; continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetState() == ITEM_REMOVED) { continue; }
|
if (item->GetState() == ITEM_REMOVED)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
Item* test = player->GetItemByPos(item->GetBagSlot(), item->GetSlot());
|
||||||
|
|
||||||
if (test == NULL)
|
if (test == NULL)
|
||||||
|
|
|
||||||
|
|
@ -2173,7 +2173,10 @@ SpellEntry const* Creature::ReachWithSpellAttack(Unit* pVictim)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bcontinue) { continue; }
|
if (bcontinue)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(spellInfo->GetManaCost() > GetPower(POWER_MANA))
|
if(spellInfo->GetManaCost() > GetPower(POWER_MANA))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,10 @@ struct VendorItemData
|
||||||
|
|
||||||
VendorItem* GetItem(uint32 slot) const
|
VendorItem* GetItem(uint32 slot) const
|
||||||
{
|
{
|
||||||
if (slot >= m_items.size()) { return NULL; }
|
if (slot >= m_items.size())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return m_items[slot];
|
return m_items[slot];
|
||||||
}
|
}
|
||||||
bool Empty() const { return m_items.empty(); }
|
bool Empty() const { return m_items.empty(); }
|
||||||
|
|
|
||||||
|
|
@ -74,17 +74,50 @@ namespace MaNGOS
|
||||||
|
|
||||||
inline uint32 GetZeroDifference(uint32 pl_level)
|
inline uint32 GetZeroDifference(uint32 pl_level)
|
||||||
{
|
{
|
||||||
if (pl_level < 8) { return 5; }
|
if (pl_level < 8)
|
||||||
if (pl_level < 10) { return 6; }
|
{
|
||||||
if (pl_level < 12) { return 7; }
|
return 5;
|
||||||
if (pl_level < 16) { return 8; }
|
}
|
||||||
if (pl_level < 20) { return 9; }
|
if (pl_level < 10)
|
||||||
if (pl_level < 30) { return 11; }
|
{
|
||||||
if (pl_level < 40) { return 12; }
|
return 6;
|
||||||
if (pl_level < 45) { return 13; }
|
}
|
||||||
if (pl_level < 50) { return 14; }
|
if (pl_level < 12)
|
||||||
if (pl_level < 55) { return 15; }
|
{
|
||||||
if (pl_level < 60) { return 16; }
|
return 7;
|
||||||
|
}
|
||||||
|
if (pl_level < 16)
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
if (pl_level < 20)
|
||||||
|
{
|
||||||
|
return 9;
|
||||||
|
}
|
||||||
|
if (pl_level < 30)
|
||||||
|
{
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
if (pl_level < 40)
|
||||||
|
{
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
if (pl_level < 45)
|
||||||
|
{
|
||||||
|
return 13;
|
||||||
|
}
|
||||||
|
if (pl_level < 50)
|
||||||
|
{
|
||||||
|
return 14;
|
||||||
|
}
|
||||||
|
if (pl_level < 55)
|
||||||
|
{
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
|
if (pl_level < 60)
|
||||||
|
{
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
return 17;
|
return 17;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -815,7 +815,10 @@ bool GameObject::IsTransport() const
|
||||||
{
|
{
|
||||||
// If something is marked as a transport, don't transmit an out of range packet for it.
|
// If something is marked as a transport, don't transmit an out of range packet for it.
|
||||||
GameObjectInfo const* gInfo = GetGOInfo();
|
GameObjectInfo const* gInfo = GetGOInfo();
|
||||||
if (!gInfo) { return false; }
|
if (!gInfo)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
|
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -941,7 +941,10 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
||||||
if (state != ITEM_UNCHANGED)
|
if (state != ITEM_UNCHANGED)
|
||||||
{
|
{
|
||||||
// new items must stay in new state until saved
|
// new items must stay in new state until saved
|
||||||
if (uState != ITEM_NEW) { uState = state; }
|
if (uState != ITEM_NEW)
|
||||||
|
{
|
||||||
|
uState = state;
|
||||||
|
}
|
||||||
|
|
||||||
if (forplayer || GetOwnerGuid())
|
if (forplayer || GetOwnerGuid())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,10 @@ void LoadRandomEnchantmentsTable()
|
||||||
|
|
||||||
uint32 GetItemEnchantMod(int32 entry)
|
uint32 GetItemEnchantMod(int32 entry)
|
||||||
{
|
{
|
||||||
if (!entry) { return 0; }
|
if (!entry)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
EnchantmentStore::const_iterator tab;
|
EnchantmentStore::const_iterator tab;
|
||||||
if (entry > 0)
|
if (entry > 0)
|
||||||
|
|
@ -134,7 +137,10 @@ uint32 GetItemEnchantMod(int32 entry)
|
||||||
{
|
{
|
||||||
fCount += ench_iter->chance;
|
fCount += ench_iter->chance;
|
||||||
|
|
||||||
if (fCount > dRoll) { return ench_iter->ench; }
|
if (fCount > dRoll)
|
||||||
|
{
|
||||||
|
return ench_iter->ench;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we could get here only if sum of all enchantment chances is lower than 100%
|
// we could get here only if sum of all enchantment chances is lower than 100%
|
||||||
|
|
@ -145,7 +151,10 @@ uint32 GetItemEnchantMod(int32 entry)
|
||||||
{
|
{
|
||||||
fCount += ench_iter->chance;
|
fCount += ench_iter->chance;
|
||||||
|
|
||||||
if (fCount > dRoll) { return ench_iter->ench; }
|
if (fCount > dRoll)
|
||||||
|
{
|
||||||
|
return ench_iter->ench;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -670,7 +670,10 @@ QuestItemList* Loot::FillFFALoot(Player* player)
|
||||||
|
|
||||||
QuestItemList* Loot::FillQuestLoot(Player* player)
|
QuestItemList* Loot::FillQuestLoot(Player* player)
|
||||||
{
|
{
|
||||||
if (items.size() == MAX_NR_LOOT_ITEMS) { return NULL; }
|
if (items.size() == MAX_NR_LOOT_ITEMS)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
QuestItemList* ql = new QuestItemList();
|
QuestItemList* ql = new QuestItemList();
|
||||||
|
|
||||||
for (uint8 i = 0; i < m_questItems.size(); ++i)
|
for (uint8 i = 0; i < m_questItems.size(); ++i)
|
||||||
|
|
|
||||||
|
|
@ -782,7 +782,10 @@ void Object::ClearUpdateMask(bool remove)
|
||||||
|
|
||||||
bool Object::LoadValues(const char* data)
|
bool Object::LoadValues(const char* data)
|
||||||
{
|
{
|
||||||
if (!m_uint32Values) { _InitValues(); }
|
if (!m_uint32Values)
|
||||||
|
{
|
||||||
|
_InitValues();
|
||||||
|
}
|
||||||
|
|
||||||
Tokens tokens = StrSplit(data, " ");
|
Tokens tokens = StrSplit(data, " ");
|
||||||
|
|
||||||
|
|
@ -1318,7 +1321,10 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
|
||||||
|
|
||||||
bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const
|
bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const
|
||||||
{
|
{
|
||||||
if (!IsInMap(obj)) { return false; }
|
if (!IsInMap(obj))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
float ox, oy, oz;
|
float ox, oy, oz;
|
||||||
obj->GetPosition(ox, oy, oz);
|
obj->GetPosition(ox, oy, oz);
|
||||||
return(IsWithinLOS(ox, oy, oz));
|
return(IsWithinLOS(ox, oy, oz));
|
||||||
|
|
|
||||||
|
|
@ -617,10 +617,19 @@ class ObjectMgr
|
||||||
|
|
||||||
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
|
PlayerInfo const* GetPlayerInfo(uint32 race, uint32 class_) const
|
||||||
{
|
{
|
||||||
if (race >= MAX_RACES) { return NULL; }
|
if (race >= MAX_RACES)
|
||||||
if (class_ >= MAX_CLASSES) { return NULL; }
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (class_ >= MAX_CLASSES)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
PlayerInfo const* info = &playerInfo[race][class_];
|
PlayerInfo const* info = &playerInfo[race][class_];
|
||||||
if (info->displayId_m == 0 || info->displayId_f == 0) { return NULL; }
|
if (info->displayId_m == 0 || info->displayId_f == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, PlayerLevelInfo* info) const;
|
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, PlayerLevelInfo* info) const;
|
||||||
|
|
@ -963,7 +972,10 @@ class ObjectMgr
|
||||||
CreatureDataPair const* GetCreatureDataPair(uint32 guid) const
|
CreatureDataPair const* GetCreatureDataPair(uint32 guid) const
|
||||||
{
|
{
|
||||||
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
|
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
|
||||||
if (itr == mCreatureDataMap.end()) { return NULL; }
|
if (itr == mCreatureDataMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &*itr;
|
return &*itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -992,7 +1004,10 @@ class ObjectMgr
|
||||||
CreatureLocale const* GetCreatureLocale(uint32 entry) const
|
CreatureLocale const* GetCreatureLocale(uint32 entry) const
|
||||||
{
|
{
|
||||||
CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
|
CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
|
||||||
if (itr == mCreatureLocaleMap.end()) { return NULL; }
|
if (itr == mCreatureLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1001,14 +1016,20 @@ class ObjectMgr
|
||||||
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
|
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
|
||||||
{
|
{
|
||||||
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
|
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
|
||||||
if (itr == mGameObjectLocaleMap.end()) { return NULL; }
|
if (itr == mGameObjectLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemLocale const* GetItemLocale(uint32 entry) const
|
ItemLocale const* GetItemLocale(uint32 entry) const
|
||||||
{
|
{
|
||||||
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
|
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
|
||||||
if (itr == mItemLocaleMap.end()) { return NULL; }
|
if (itr == mItemLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1017,7 +1038,10 @@ class ObjectMgr
|
||||||
QuestLocale const* GetQuestLocale(uint32 entry) const
|
QuestLocale const* GetQuestLocale(uint32 entry) const
|
||||||
{
|
{
|
||||||
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
|
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
|
||||||
if (itr == mQuestLocaleMap.end()) { return NULL; }
|
if (itr == mQuestLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1026,7 +1050,10 @@ class ObjectMgr
|
||||||
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
|
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
|
||||||
{
|
{
|
||||||
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
|
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
|
||||||
if (itr == mNpcTextLocaleMap.end()) { return NULL; }
|
if (itr == mNpcTextLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1037,28 +1064,40 @@ class ObjectMgr
|
||||||
PageTextLocale const* GetPageTextLocale(uint32 entry) const
|
PageTextLocale const* GetPageTextLocale(uint32 entry) const
|
||||||
{
|
{
|
||||||
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
|
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
|
||||||
if (itr == mPageTextLocaleMap.end()) { return NULL; }
|
if (itr == mPageTextLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
|
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
|
||||||
{
|
{
|
||||||
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
|
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
|
||||||
if (itr == mGossipMenuItemsLocaleMap.end()) { return NULL; }
|
if (itr == mGossipMenuItemsLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
|
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
|
||||||
{
|
{
|
||||||
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
|
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
|
||||||
if (itr == mPointOfInterestLocaleMap.end()) { return NULL; }
|
if (itr == mPointOfInterestLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObjectDataPair const* GetGODataPair(uint32 guid) const
|
GameObjectDataPair const* GetGODataPair(uint32 guid) const
|
||||||
{
|
{
|
||||||
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
|
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
|
||||||
if (itr == mGameObjectDataMap.end()) { return NULL; }
|
if (itr == mGameObjectDataMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &*itr;
|
return &*itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1087,7 +1126,10 @@ class ObjectMgr
|
||||||
MangosStringLocale const* GetMangosStringLocale(int32 entry) const
|
MangosStringLocale const* GetMangosStringLocale(int32 entry) const
|
||||||
{
|
{
|
||||||
MangosStringLocaleMap::const_iterator itr = mMangosStringLocaleMap.find(entry);
|
MangosStringLocaleMap::const_iterator itr = mMangosStringLocaleMap.find(entry);
|
||||||
if (itr == mMangosStringLocaleMap.end()) { return NULL; }
|
if (itr == mMangosStringLocaleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
uint32 GetLoadedStringsCount(int32 minEntry) const
|
uint32 GetLoadedStringsCount(int32 minEntry) const
|
||||||
|
|
@ -1142,7 +1184,10 @@ class ObjectMgr
|
||||||
GameTele const* GetGameTele(uint32 id) const
|
GameTele const* GetGameTele(uint32 id) const
|
||||||
{
|
{
|
||||||
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
|
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
|
||||||
if (itr == m_GameTeleMap.end()) { return NULL; }
|
if (itr == m_GameTeleMap.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1173,8 +1173,14 @@ class Player : public Unit
|
||||||
void SetGMVisible(bool on);
|
void SetGMVisible(bool on);
|
||||||
void SetPvPDeath(bool on)
|
void SetPvPDeath(bool on)
|
||||||
{
|
{
|
||||||
if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; }
|
if (on)
|
||||||
else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
|
{
|
||||||
|
m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 = own auction, -1 = enemy auction, 1 = goblin auction
|
// 0 = own auction, -1 = enemy auction, 1 = goblin auction
|
||||||
|
|
|
||||||
|
|
@ -2197,7 +2197,10 @@ void Unit::CalculateMeleeDamage(Unit* pVictim, CalcDamageInfo* damageInfo, Weapo
|
||||||
|
|
||||||
void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
|
||||||
{
|
{
|
||||||
if (damageInfo == 0) { return; }
|
if (damageInfo == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
Unit* pVictim = damageInfo->target;
|
Unit* pVictim = damageInfo->target;
|
||||||
|
|
||||||
if (!this || !pVictim)
|
if (!this || !pVictim)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,10 @@ class MapReference : public Reference<Map, Player>
|
||||||
void targetObjectDestroyLink() override
|
void targetObjectDestroyLink() override
|
||||||
{
|
{
|
||||||
// called from unlink()
|
// called from unlink()
|
||||||
if (isValid()) { getTarget()->m_mapRefManager.decSize(); }
|
if (isValid())
|
||||||
|
{
|
||||||
|
getTarget()->m_mapRefManager.decSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void sourceObjectDestroyLink() override
|
void sourceObjectDestroyLink() override
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -485,7 +485,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
|
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
else { incHighest = false; }
|
else
|
||||||
|
{
|
||||||
|
incHighest = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); }
|
{ guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); }
|
||||||
|
|
@ -528,7 +531,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||||
{
|
{
|
||||||
if (!fgets(buf, 32000, fin))
|
if (!fgets(buf, 32000, fin))
|
||||||
{
|
{
|
||||||
if (feof(fin)) { break; }
|
if (feof(fin))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
ROLLBACK(DUMP_FILE_BROKEN);
|
ROLLBACK(DUMP_FILE_BROKEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1471,8 +1471,8 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
||||||
/*
|
/*
|
||||||
|
|
||||||
valid examples:
|
valid examples:
|
||||||
|cff00aa00|Hcurrency:391|h[Рекомендательный значок Тол Барада]|h|r
|
|cff00aa00|Hcurrency:391|h[<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]|h|r
|
||||||
|cffff8000|Hinstancelock:070000000177AF81:532:0:1|h[Каражан]|h|r NYI
|
|cffff8000|Hinstancelock:070000000177AF81:532:0:1|h[<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]|h|r NYI
|
||||||
|cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r
|
|cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r
|
||||||
|cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r
|
|cff808080|Hquest:2278:47|h[The Platinum Discs]|h|r
|
||||||
|cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r
|
|cffffd000|Htrade:4037:1:150:1:6AAAAAAAAAAAAAAAAAAAAAAOAADAAAAAAAAAAAAAAAAIAAAAAAAAA|h[Engineering]|h|r
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,14 @@ class Map : public GridRefManager<NGridType>
|
||||||
// currently unused for normal maps
|
// currently unused for normal maps
|
||||||
bool CanUnload(uint32 diff)
|
bool CanUnload(uint32 diff)
|
||||||
{
|
{
|
||||||
if (!m_unloadTimer) { return false; }
|
if (!m_unloadTimer)
|
||||||
if (m_unloadTimer <= diff) { return true; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (m_unloadTimer <= diff)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
m_unloadTimer -= diff;
|
m_unloadTimer -= diff;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7121,8 +7121,14 @@ void Aura::HandleShapeshiftBoosts(bool apply)
|
||||||
const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap();
|
const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap();
|
||||||
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
|
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->second.state == PLAYERSPELL_REMOVED) { continue; }
|
if (itr->second.state == PLAYERSPELL_REMOVED)
|
||||||
if (itr->first == spellId1 || itr->first == spellId2) { continue; }
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (itr->first == spellId1 || itr->first == spellId2)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
|
||||||
if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form))
|
if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3034,13 +3034,25 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
|
||||||
{
|
{
|
||||||
float stat = 0.0f;
|
float stat = 0.0f;
|
||||||
// strength
|
// strength
|
||||||
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH); }
|
if (GetStat(STAT_STRENGTH) > stat)
|
||||||
|
{
|
||||||
|
trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH);
|
||||||
|
}
|
||||||
// agility
|
// agility
|
||||||
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY); }
|
if (GetStat(STAT_AGILITY) > stat)
|
||||||
|
{
|
||||||
|
trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY);
|
||||||
|
}
|
||||||
// intellect
|
// intellect
|
||||||
if (GetStat(STAT_INTELLECT) > stat) { trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);}
|
if (GetStat(STAT_INTELLECT) > stat)
|
||||||
|
{
|
||||||
|
trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);
|
||||||
|
}
|
||||||
// spirit
|
// spirit
|
||||||
if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; }
|
if (GetStat(STAT_SPIRIT) > stat)
|
||||||
|
{
|
||||||
|
trigger_spell_id = 60235;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// case 55580: break: // Mana Link
|
// case 55580: break: // Mana Link
|
||||||
|
|
@ -3093,18 +3105,30 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit* pVictim, uint32 d
|
||||||
{
|
{
|
||||||
float stat = 0.0f;
|
float stat = 0.0f;
|
||||||
// strength
|
// strength
|
||||||
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH); }
|
if (GetStat(STAT_STRENGTH) > stat)
|
||||||
|
{
|
||||||
|
trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH);
|
||||||
|
}
|
||||||
// agility
|
// agility
|
||||||
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; }
|
if (GetStat(STAT_AGILITY) > stat)
|
||||||
|
{
|
||||||
|
trigger_spell_id = 67703;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
|
case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
|
||||||
{
|
{
|
||||||
float stat = 0.0f;
|
float stat = 0.0f;
|
||||||
// strength
|
// strength
|
||||||
if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH); }
|
if (GetStat(STAT_STRENGTH) > stat)
|
||||||
|
{
|
||||||
|
trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH);
|
||||||
|
}
|
||||||
// agility
|
// agility
|
||||||
if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; }
|
if (GetStat(STAT_AGILITY) > stat)
|
||||||
|
{
|
||||||
|
trigger_spell_id = 67772;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 69023: // Mirrored Soul
|
case 69023: // Mirrored Soul
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,10 @@ class BIH
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst);
|
bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirst);
|
||||||
if (stopAtFirst && hit) { return; }
|
if (stopAtFirst && hit)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
--n;
|
--n;
|
||||||
++offset;
|
++offset;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -313,20 +313,35 @@ namespace VMAP
|
||||||
{
|
{
|
||||||
char chunk[8];
|
char chunk[8];
|
||||||
// general info
|
// general info
|
||||||
if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) { success = false; }
|
if (!readChunk(rf, chunk, VMAP_MAGIC, 8))
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
char tiled=0;
|
char tiled=0;
|
||||||
if (success && fread(&tiled, sizeof(char), 1, rf) != 1) { success = false; }
|
if (success && fread(&tiled, sizeof(char), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
iIsTiled = bool(tiled);
|
iIsTiled = bool(tiled);
|
||||||
// Nodes
|
// Nodes
|
||||||
if (success && !readChunk(rf, chunk, "NODE", 4)) { success = false; }
|
if (success && !readChunk(rf, chunk, "NODE", 4))
|
||||||
if (success) { success = iTree.readFromFile(rf); }
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
success = iTree.readFromFile(rf);
|
||||||
|
}
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
iNTreeValues = iTree.primCount();
|
iNTreeValues = iTree.primCount();
|
||||||
iTreeValues = new ModelInstance[iNTreeValues];
|
iTreeValues = new ModelInstance[iNTreeValues];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success && !readChunk(rf, chunk, "GOBJ", 4)) { success = false; }
|
if (success && !readChunk(rf, chunk, "GOBJ", 4))
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
// global model spawns
|
// global model spawns
|
||||||
// only non-tiled maps have them, and if so exactly one (so far at least...)
|
// only non-tiled maps have them, and if so exactly one (so far at least...)
|
||||||
ModelSpawn spawn;
|
ModelSpawn spawn;
|
||||||
|
|
|
||||||
|
|
@ -229,9 +229,15 @@ namespace VMAP
|
||||||
}
|
}
|
||||||
uint32 nameLen = spawn.name.length();
|
uint32 nameLen = spawn.name.length();
|
||||||
check += fwrite(&nameLen, sizeof(uint32), 1, wf);
|
check += fwrite(&nameLen, sizeof(uint32), 1, wf);
|
||||||
if (check != uint32(has_bound ? 17 : 11)) { return false; }
|
if (check != uint32(has_bound ? 17 : 11))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
check = fwrite(spawn.name.c_str(), sizeof(char), nameLen, wf);
|
check = fwrite(spawn.name.c_str(), sizeof(char), nameLen, wf);
|
||||||
if (check != nameLen) { return false; }
|
if (check != nameLen)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,10 @@ namespace VMAP
|
||||||
{
|
{
|
||||||
bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len)
|
bool readChunk(FILE* rf, char* dest, const char* compare, uint32 len)
|
||||||
{
|
{
|
||||||
if (fread(dest, sizeof(char), len, rf) != len) { return false; }
|
if (fread(dest, sizeof(char), len, rf) != len)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return memcmp(dest, compare, len) == 0;
|
return memcmp(dest, compare, len) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,16 +133,31 @@ namespace VMAP
|
||||||
}
|
}
|
||||||
|
|
||||||
// general info
|
// general info
|
||||||
if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8) { success = false; }
|
if (success && fwrite(VMAP_MAGIC, 1, 8, mapfile) != 8)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
uint32 globalTileID = StaticMapTree::packTileID(65, 65);
|
uint32 globalTileID = StaticMapTree::packTileID(65, 65);
|
||||||
pair<TileMap::iterator, TileMap::iterator> globalRange = map_iter->second->TileEntries.equal_range(globalTileID);
|
pair<TileMap::iterator, TileMap::iterator> globalRange = map_iter->second->TileEntries.equal_range(globalTileID);
|
||||||
char isTiled = globalRange.first == globalRange.second; // only maps without terrain (tiles) have global WMO
|
char isTiled = globalRange.first == globalRange.second; // only maps without terrain (tiles) have global WMO
|
||||||
if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1) { success = false; }
|
if (success && fwrite(&isTiled, sizeof(char), 1, mapfile) != 1)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
// Nodes
|
// Nodes
|
||||||
if (success && fwrite("NODE", 4, 1, mapfile) != 1) { success = false; }
|
if (success && fwrite("NODE", 4, 1, mapfile) != 1)
|
||||||
if (success) { success = pTree.writeToFile(mapfile); }
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
success = pTree.writeToFile(mapfile);
|
||||||
|
}
|
||||||
// global map spawns (WDT), if any (most instances)
|
// global map spawns (WDT), if any (most instances)
|
||||||
if (success && fwrite("GOBJ", 4, 1, mapfile) != 1) { success = false; }
|
if (success && fwrite("GOBJ", 4, 1, mapfile) != 1)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
for (TileMap::iterator glob = globalRange.first; glob != globalRange.second && success; ++glob)
|
for (TileMap::iterator glob = globalRange.first; glob != globalRange.second && success; ++glob)
|
||||||
{
|
{
|
||||||
|
|
@ -169,9 +187,15 @@ namespace VMAP
|
||||||
tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile";
|
tilefilename << std::setw(2) << x << "_" << std::setw(2) << y << ".vmtile";
|
||||||
FILE* tilefile = fopen(tilefilename.str().c_str(), "wb");
|
FILE* tilefile = fopen(tilefilename.str().c_str(), "wb");
|
||||||
// file header
|
// file header
|
||||||
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) { success = false; }
|
if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
// write number of tile spawns
|
// write number of tile spawns
|
||||||
if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1) { success = false; }
|
if (success && fwrite(&nSpawns, sizeof(uint32), 1, tilefile) != 1)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
// write tile spawns
|
// write tile spawns
|
||||||
for (uint32 s = 0; s < nSpawns; ++s)
|
for (uint32 s = 0; s < nSpawns; ++s)
|
||||||
{
|
{
|
||||||
|
|
@ -183,7 +207,10 @@ namespace VMAP
|
||||||
success = success && ModelSpawn::writeToFile(tilefile, spawn2);
|
success = success && ModelSpawn::writeToFile(tilefile, spawn2);
|
||||||
// MapTree nodes to update when loading tile:
|
// MapTree nodes to update when loading tile:
|
||||||
std::map<uint32, uint32>::iterator nIdx = modelNodeIdx.find(spawn2.ID);
|
std::map<uint32, uint32>::iterator nIdx = modelNodeIdx.find(spawn2.ID);
|
||||||
if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1) { success = false; }
|
if (success && fwrite(&nIdx->second, sizeof(uint32), 1, tilefile) != 1)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fclose(tilefile);
|
fclose(tilefile);
|
||||||
}
|
}
|
||||||
|
|
@ -250,7 +277,10 @@ namespace VMAP
|
||||||
printf("spawning Map %d\n", mapID);
|
printf("spawning Map %d\n", mapID);
|
||||||
mapData[mapID] = current = new MapSpawns();
|
mapData[mapID] = current = new MapSpawns();
|
||||||
}
|
}
|
||||||
else { current = (*map_iter).second; }
|
else
|
||||||
|
{
|
||||||
|
current = (*map_iter).second;
|
||||||
|
}
|
||||||
current->UniqueEntries.insert(pair<uint32, ModelSpawn>(spawn.ID, spawn));
|
current->UniqueEntries.insert(pair<uint32, ModelSpawn>(spawn.ID, spawn));
|
||||||
current->TileEntries.insert(pair<uint32, uint32>(StaticMapTree::packTileID(tileX, tileY), spawn.ID));
|
current->TileEntries.insert(pair<uint32, uint32>(StaticMapTree::packTileID(tileX, tileY), spawn.ID));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -229,14 +229,32 @@ namespace VMAP
|
||||||
bool WmoLiquid::writeToFile(FILE* wf)
|
bool WmoLiquid::writeToFile(FILE* wf)
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1) { result = false; }
|
if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1)
|
||||||
if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1) { result = false; }
|
{
|
||||||
if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1) { result = false; }
|
result = false;
|
||||||
if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1) { result = false; }
|
}
|
||||||
|
if (result && fwrite(&iTilesY, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fwrite(&iCorner, sizeof(Vector3), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fwrite(&iType, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
uint32 size = (iTilesX + 1) * (iTilesY + 1);
|
uint32 size = (iTilesX + 1) * (iTilesY + 1);
|
||||||
if (result && fwrite(iHeight, sizeof(float), size, wf) != size) { result = false; }
|
if (result && fwrite(iHeight, sizeof(float), size, wf) != size)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
size = iTilesX * iTilesY;
|
size = iTilesX * iTilesY;
|
||||||
if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size) { result = false; }
|
if (result && fwrite(iFlags, sizeof(uint8), size, wf) != size)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -244,16 +262,34 @@ namespace VMAP
|
||||||
{
|
{
|
||||||
bool result = true;
|
bool result = true;
|
||||||
WmoLiquid* liquid = new WmoLiquid();
|
WmoLiquid* liquid = new WmoLiquid();
|
||||||
if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1) { result = false; }
|
if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1)
|
||||||
if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1) { result = false; }
|
{
|
||||||
if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1) { result = false; }
|
result = false;
|
||||||
if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1) { result = false; }
|
}
|
||||||
|
if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&liquid->iType, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
uint32 size = (liquid->iTilesX + 1) * (liquid->iTilesY + 1);
|
uint32 size = (liquid->iTilesX + 1) * (liquid->iTilesY + 1);
|
||||||
liquid->iHeight = new float[size];
|
liquid->iHeight = new float[size];
|
||||||
if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size) { result = false; }
|
if (result && fread(liquid->iHeight, sizeof(float), size, rf) != size)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
size = liquid->iTilesX * liquid->iTilesY;
|
size = liquid->iTilesX * liquid->iTilesY;
|
||||||
liquid->iFlags = new uint8[size];
|
liquid->iFlags = new uint8[size];
|
||||||
if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size) { result = false; }
|
if (result && fread(liquid->iFlags, sizeof(uint8), size, rf) != size)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
delete liquid;
|
delete liquid;
|
||||||
|
|
@ -290,41 +326,89 @@ namespace VMAP
|
||||||
bool result = true;
|
bool result = true;
|
||||||
uint32 chunkSize, count;
|
uint32 chunkSize, count;
|
||||||
|
|
||||||
if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1) { result = false; }
|
if (result && fwrite(&iBound, sizeof(G3D::AABox), 1, wf) != 1)
|
||||||
if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1) { result = false; }
|
{
|
||||||
if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1) { result = false; }
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fwrite(&iMogpFlags, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fwrite(&iGroupWMOID, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
// write vertices
|
// write vertices
|
||||||
if (result && fwrite("VERT", 1, 4, wf) != 4) { result = false; }
|
if (result && fwrite("VERT", 1, 4, wf) != 4)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
count = vertices.size();
|
count = vertices.size();
|
||||||
chunkSize = sizeof(uint32) + sizeof(Vector3) * count;
|
chunkSize = sizeof(uint32) + sizeof(Vector3) * count;
|
||||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; }
|
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
|
||||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
if (!count) // models without (collision) geometry end here, unsure if they are useful
|
if (!count) // models without (collision) geometry end here, unsure if they are useful
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count) { result = false; }
|
if (result && fwrite(&vertices[0], sizeof(Vector3), count, wf) != count)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
// write triangle mesh
|
// write triangle mesh
|
||||||
if (result && fwrite("TRIM", 1, 4, wf) != 4) { result = false; }
|
if (result && fwrite("TRIM", 1, 4, wf) != 4)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
count = triangles.size();
|
count = triangles.size();
|
||||||
chunkSize = sizeof(uint32) + sizeof(MeshTriangle) * count;
|
chunkSize = sizeof(uint32) + sizeof(MeshTriangle) * count;
|
||||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; }
|
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
|
||||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
if (count)
|
if (count)
|
||||||
if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count) { result = false; }
|
if (result && fwrite(&triangles[0], sizeof(MeshTriangle), count, wf) != count)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
// write mesh BIH
|
// write mesh BIH
|
||||||
if (result && fwrite("MBIH", 1, 4, wf) != 4) { result = false; }
|
if (result && fwrite("MBIH", 1, 4, wf) != 4)
|
||||||
if (result) { result = meshTree.writeToFile(wf); }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
result = meshTree.writeToFile(wf);
|
||||||
|
}
|
||||||
|
|
||||||
// write liquid data
|
// write liquid data
|
||||||
if (result && fwrite("LIQU", 1, 4, wf) != 4) { result = false; }
|
if (result && fwrite("LIQU", 1, 4, wf) != 4)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
chunkSize = iLiquid ? iLiquid->GetFileSize() : 0;
|
chunkSize = iLiquid ? iLiquid->GetFileSize() : 0;
|
||||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; }
|
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
if (chunkSize)
|
if (chunkSize)
|
||||||
if (result) { result = iLiquid->writeToFile(wf); }
|
if (result)
|
||||||
|
{
|
||||||
|
result = iLiquid->writeToFile(wf);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -340,38 +424,89 @@ namespace VMAP
|
||||||
delete iLiquid;
|
delete iLiquid;
|
||||||
iLiquid = 0;
|
iLiquid = 0;
|
||||||
|
|
||||||
if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1) { result = false; }
|
if (result && fread(&iBound, sizeof(G3D::AABox), 1, rf) != 1)
|
||||||
if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1) { result = false; }
|
{
|
||||||
if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1) { result = false; }
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&iMogpFlags, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&iGroupWMOID, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
// read vertices
|
// read vertices
|
||||||
if (result && !readChunk(rf, chunk, "VERT", 4)) { result = false; }
|
if (result && !readChunk(rf, chunk, "VERT", 4))
|
||||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; }
|
{
|
||||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; }
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
if (!count) // models without (collision) geometry end here, unsure if they are useful
|
if (!count) // models without (collision) geometry end here, unsure if they are useful
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (result) { vertices.resize(count); }
|
if (result)
|
||||||
if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count) { result = false; }
|
{
|
||||||
|
vertices.resize(count);
|
||||||
|
}
|
||||||
|
if (result && fread(&vertices[0], sizeof(Vector3), count, rf) != count)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
// read triangle mesh
|
// read triangle mesh
|
||||||
if (result && !readChunk(rf, chunk, "TRIM", 4)) { result = false; }
|
if (result && !readChunk(rf, chunk, "TRIM", 4))
|
||||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; }
|
{
|
||||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; }
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
if (result) { triangles.resize(count); }
|
if (result)
|
||||||
if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count) { result = false; }
|
{
|
||||||
|
triangles.resize(count);
|
||||||
|
}
|
||||||
|
if (result && fread(&triangles[0], sizeof(MeshTriangle), count, rf) != count)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// read mesh BIH
|
// read mesh BIH
|
||||||
if (result && !readChunk(rf, chunk, "MBIH", 4)) { result = false; }
|
if (result && !readChunk(rf, chunk, "MBIH", 4))
|
||||||
if (result) { result = meshTree.readFromFile(rf); }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
result = meshTree.readFromFile(rf);
|
||||||
|
}
|
||||||
|
|
||||||
// read liquid data
|
// read liquid data
|
||||||
if (result && !readChunk(rf, chunk, "LIQU", 4)) { result = false; }
|
if (result && !readChunk(rf, chunk, "LIQU", 4))
|
||||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
if (result && chunkSize > 0)
|
if (result && chunkSize > 0)
|
||||||
{
|
{
|
||||||
result = WmoLiquid::readFromFile(rf, iLiquid);
|
result = WmoLiquid::readFromFile(rf, iLiquid);
|
||||||
|
|
@ -386,7 +521,10 @@ namespace VMAP
|
||||||
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool /*pStopAtFirstHit*/)
|
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool /*pStopAtFirstHit*/)
|
||||||
{
|
{
|
||||||
bool result = IntersectTriangle(triangles[entry], vertices, ray, distance);
|
bool result = IntersectTriangle(triangles[entry], vertices, ray, distance);
|
||||||
if (result) { hit = true; }
|
if (result)
|
||||||
|
{
|
||||||
|
hit = true;
|
||||||
|
}
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
std::vector<Vector3>::const_iterator vertices;
|
std::vector<Vector3>::const_iterator vertices;
|
||||||
|
|
@ -455,7 +593,10 @@ namespace VMAP
|
||||||
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit)
|
bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit)
|
||||||
{
|
{
|
||||||
bool result = models[entry].IntersectRay(ray, distance, pStopAtFirstHit);
|
bool result = models[entry].IntersectRay(ray, distance, pStopAtFirstHit);
|
||||||
if (result) { hit = true; }
|
if (result)
|
||||||
|
{
|
||||||
|
hit = true;
|
||||||
|
}
|
||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
std::vector<GroupModel>::const_iterator models;
|
std::vector<GroupModel>::const_iterator models;
|
||||||
|
|
@ -561,25 +702,46 @@ namespace VMAP
|
||||||
|
|
||||||
uint32 chunkSize, count;
|
uint32 chunkSize, count;
|
||||||
bool result = fwrite(VMAP_MAGIC, 1, 8, wf) == 8;
|
bool result = fwrite(VMAP_MAGIC, 1, 8, wf) == 8;
|
||||||
if (result && fwrite("WMOD", 1, 4, wf) != 4) { result = false; }
|
if (result && fwrite("WMOD", 1, 4, wf) != 4)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
chunkSize = sizeof(uint32) + sizeof(uint32);
|
chunkSize = sizeof(uint32) + sizeof(uint32);
|
||||||
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) { result = false; }
|
if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1)
|
||||||
if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1) { result = false; }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fwrite(&RootWMOID, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
// write group models
|
// write group models
|
||||||
count = groupModels.size();
|
count = groupModels.size();
|
||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
if (result && fwrite("GMOD", 1, 4, wf) != 4) { result = false; }
|
if (result && fwrite("GMOD", 1, 4, wf) != 4)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
// chunkSize = sizeof(uint32)+ sizeof(GroupModel)*count;
|
// chunkSize = sizeof(uint32)+ sizeof(GroupModel)*count;
|
||||||
// if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false;
|
// if (result && fwrite(&chunkSize, sizeof(uint32), 1, wf) != 1) result = false;
|
||||||
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1) { result = false; }
|
if (result && fwrite(&count, sizeof(uint32), 1, wf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
for (uint32 i = 0; i < groupModels.size() && result; ++i)
|
for (uint32 i = 0; i < groupModels.size() && result; ++i)
|
||||||
{ result = groupModels[i].writeToFile(wf); }
|
{ result = groupModels[i].writeToFile(wf); }
|
||||||
|
|
||||||
// write group BIH
|
// write group BIH
|
||||||
if (result && fwrite("GBIH", 1, 4, wf) != 4) { result = false; }
|
if (result && fwrite("GBIH", 1, 4, wf) != 4)
|
||||||
if (result) { result = groupTree.writeToFile(wf); }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
result = groupTree.writeToFile(wf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(wf);
|
fclose(wf);
|
||||||
|
|
@ -598,26 +760,50 @@ namespace VMAP
|
||||||
uint32 chunkSize = 0;
|
uint32 chunkSize = 0;
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
char chunk[8]; // Ignore the added magic header
|
char chunk[8]; // Ignore the added magic header
|
||||||
if (!readChunk(rf, chunk, VMAP_MAGIC, 8)) { result = false; }
|
if (!readChunk(rf, chunk, VMAP_MAGIC, 8))
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (result && !readChunk(rf, chunk, "WMOD", 4)) { result = false; }
|
if (result && !readChunk(rf, chunk, "WMOD", 4))
|
||||||
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1) { result = false; }
|
{
|
||||||
if (result && fread(&RootWMOID, sizeof(uint32), 1, rf) != 1) { result = false; }
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&chunkSize, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result && fread(&RootWMOID, sizeof(uint32), 1, rf) != 1)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
// read group models
|
// read group models
|
||||||
if (result && readChunk(rf, chunk, "GMOD", 4))
|
if (result && readChunk(rf, chunk, "GMOD", 4))
|
||||||
{
|
{
|
||||||
// if (fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false;
|
// if (fread(&chunkSize, sizeof(uint32), 1, rf) != 1) result = false;
|
||||||
|
|
||||||
if (result && fread(&count, sizeof(uint32), 1, rf) != 1) { result = false; }
|
if (result && fread(&count, sizeof(uint32), 1, rf) != 1)
|
||||||
if (result) { groupModels.resize(count); }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
groupModels.resize(count);
|
||||||
|
}
|
||||||
// if (result && fread(&groupModels[0], sizeof(GroupModel), count, rf) != count) result = false;
|
// if (result && fread(&groupModels[0], sizeof(GroupModel), count, rf) != count) result = false;
|
||||||
for (uint32 i = 0; i < count && result; ++i)
|
for (uint32 i = 0; i < count && result; ++i)
|
||||||
{ result = groupModels[i].readFromFile(rf); }
|
{ result = groupModels[i].readFromFile(rf); }
|
||||||
|
|
||||||
// read group BIH
|
// read group BIH
|
||||||
if (result && !readChunk(rf, chunk, "GBIH", 4)) { result = false; }
|
if (result && !readChunk(rf, chunk, "GBIH", 4))
|
||||||
if (result) { result = groupTree.readFromFile(rf); }
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
result = groupTree.readFromFile(rf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(rf);
|
fclose(rf);
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,10 @@ BigNumber::BigNumber(uint32 val)
|
||||||
BigNumber::~BigNumber()
|
BigNumber::~BigNumber()
|
||||||
{
|
{
|
||||||
BN_free(_bn);
|
BN_free(_bn);
|
||||||
if (_array) { delete[] _array; }
|
if (_array)
|
||||||
|
{
|
||||||
|
delete[] _array;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BigNumber::SetDword(uint32 val)
|
void BigNumber::SetDword(uint32 val)
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,10 @@ void Database::InitDelayThread()
|
||||||
|
|
||||||
void Database::HaltDelayThread()
|
void Database::HaltDelayThread()
|
||||||
{
|
{
|
||||||
if (!m_threadBody || !m_delayThread) { return; }
|
if (!m_threadBody || !m_delayThread)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_threadBody->Stop(); // Stop event
|
m_threadBody->Stop(); // Stop event
|
||||||
m_delayThread->wait(); // Wait for flush to DB
|
m_delayThread->wait(); // Wait for flush to DB
|
||||||
|
|
@ -329,7 +332,10 @@ bool Database::PExecuteLog(const char* format, ...)
|
||||||
|
|
||||||
QueryResult* Database::PQuery(const char* format, ...)
|
QueryResult* Database::PQuery(const char* format, ...)
|
||||||
{
|
{
|
||||||
if (!format) { return NULL; }
|
if (!format)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char szQuery [MAX_QUERY_LEN];
|
char szQuery [MAX_QUERY_LEN];
|
||||||
|
|
@ -348,7 +354,10 @@ QueryResult* Database::PQuery(const char* format, ...)
|
||||||
|
|
||||||
QueryNamedResult* Database::PQueryNamed(const char* format, ...)
|
QueryNamedResult* Database::PQueryNamed(const char* format, ...)
|
||||||
{
|
{
|
||||||
if (!format) { return NULL; }
|
if (!format)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char szQuery [MAX_QUERY_LEN];
|
char szQuery [MAX_QUERY_LEN];
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,10 @@ bool SqlQueryHolderEx::Execute(SqlConnection* conn)
|
||||||
{
|
{
|
||||||
/// execute all queries in the holder and pass the results
|
/// execute all queries in the holder and pass the results
|
||||||
char const* sql = queries[i].first;
|
char const* sql = queries[i].first;
|
||||||
if (sql) { m_holder->SetResult(i, conn->Query(sql)); }
|
if (sql)
|
||||||
|
{
|
||||||
|
m_holder->SetResult(i, conn->Query(sql));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// sync with the caller thread
|
/// sync with the caller thread
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,10 @@ void BarGoLink::step()
|
||||||
|
|
||||||
int i, n;
|
int i, n;
|
||||||
|
|
||||||
if (num_rec == 0) { return; }
|
if (num_rec == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
++rec_no;
|
++rec_no;
|
||||||
n = rec_no * indic_len / num_rec;
|
n = rec_no * indic_len / num_rec;
|
||||||
if (n != rec_pos)
|
if (n != rec_pos)
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,10 @@ Tokens StrSplit(const std::string& src, const std::string& sep)
|
||||||
{
|
{
|
||||||
if (sep.find(*i) != std::string::npos)
|
if (sep.find(*i) != std::string::npos)
|
||||||
{
|
{
|
||||||
if (s.length()) { r.push_back(s); }
|
if (s.length())
|
||||||
|
{
|
||||||
|
r.push_back(s);
|
||||||
|
}
|
||||||
s = "";
|
s = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -141,7 +144,10 @@ Tokens StrSplit(const std::string& src, const std::string& sep)
|
||||||
s += *i;
|
s += *i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (s.length()) { r.push_back(s); }
|
if (s.length())
|
||||||
|
{
|
||||||
|
r.push_back(s);
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,10 @@ void WINAPI ServiceMain(DWORD argc, char* argv[])
|
||||||
|
|
||||||
for (i = 0; i < std::strlen(path); ++i)
|
for (i = 0; i < std::strlen(path); ++i)
|
||||||
{
|
{
|
||||||
if (path[i] == '\\') { last_slash = i; }
|
if (path[i] == '\\')
|
||||||
|
{
|
||||||
|
last_slash = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
path[last_slash] = 0;
|
path[last_slash] = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue