diff --git a/contrib/vmap_assembler/vmap_assembler.cpp b/contrib/vmap_assembler/vmap_assembler.cpp index 233d4ba3c..7da98b599 100644 --- a/contrib/vmap_assembler/vmap_assembler.cpp +++ b/contrib/vmap_assembler/vmap_assembler.cpp @@ -78,41 +78,43 @@ bool readConfigFile(char *pConffile, VMAP::TileAssembler* pTa) //======================================================= int main(int argc, char* argv[]) { - if(argc == 3 || argc == 4) - { - bool ok = true; - char *src = argv[1]; - char *dest = argv[2]; - char *conffile = NULL; - if(argc >= 4) { - conffile = argv[3]; - } - VMAP::TileAssembler* ta = new VMAP::TileAssembler(std::string(src), std::string(dest)); - ta->setModelNameFilterMethod(modelNameFilter); - - /* - All the names in the list are considered to be world maps or huge instances. - These maps will be spilt into tiles in the vmap assemble process - */ - if(conffile != NULL) { - ok = readConfigFile(conffile, ta); - if(!ok) { - printf("Can not open file config file: %s\n", conffile); - } - } - if(ok) { ok = ta->convertWorld(); } - if(ok) { - printf("Ok, all done\n"); - } else { - printf("exit with errors\n"); - return 1; - } - delete ta; - } - else + if(argc != 3 && argc != 4) { printf("\nusage: %s [config file name]\n", argv[0]); return 1; } + + char *src = argv[1]; + char *dest = argv[2]; + char *conffile = NULL; + if(argc >= 4) + conffile = argv[3]; + + VMAP::TileAssembler* ta = new VMAP::TileAssembler(std::string(src), std::string(dest)); + ta->setModelNameFilterMethod(modelNameFilter); + + /* + All the names in the list are considered to be world maps or huge instances. + These maps will be spilt into tiles in the vmap assemble process + */ + if(conffile != NULL) + { + if(!readConfigFile(conffile, ta)) + { + printf("Can not open file config file: %s\n", conffile); + delete ta; + return 1; + } + } + + if(!ta->convertWorld()) + { + printf("exit with errors\n"); + delete ta; + return 1; + } + + delete ta; + printf("Ok, all done\n"); return 0; } diff --git a/contrib/vmap_extract_assembler_bin/vmap_assembler.exe b/contrib/vmap_extract_assembler_bin/vmap_assembler.exe index a6ef74dc0..9c8b5f2d3 100644 Binary files a/contrib/vmap_extract_assembler_bin/vmap_assembler.exe and b/contrib/vmap_extract_assembler_bin/vmap_assembler.exe differ diff --git a/doc/EventAI.txt b/doc/EventAI.txt index 5137c26dd..76e4fa20c 100644 --- a/doc/EventAI.txt +++ b/doc/EventAI.txt @@ -530,10 +530,12 @@ This is commonly used in combination with EVENT_T_RANGE and ACTION_T_COMBAT_MOVE 21 = ACTION_T_COMBAT_MOVEMENT: ------------------------------ Parameter 1: If zero, then the creature will stop moving towards its victim (if its victim gets out of melee range) and will be stationary. If non-zero, then the creature will either continue to follow its victim (the action would have no effect) or it will start to follow the target with the top threat if its movement was disabled before. +Parameter 2: If non-zero, then stop melee combat state (if param1=0) or start melee combat state (if param1!=0) and creature in combat with selected target. This action controls whether or not the creature will always move towards its target. NOTE: The ACID Dev Team has conformed to using either 0 or 1 for the Param values. (0 = Stop Movement, 1 = Start Movement) This is commonly used with EVENT_T_RANGE and ACTION_T_AUTO_ATTACK for NPC's who engage in Ranged Comabt (Either Spells or Ranged Attacks) +Parameter 2 specialy used for ranged combat proper client side visual show ranged weapon in proper state. ------------------------ 22 = ACTION_T_SET_PHASE: diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index f01f0b835..a4598b1a2 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -589,6 +589,8 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS: case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED: case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN: case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS: @@ -1063,7 +1065,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(miscvalue1 != achievementCriteria->equip_item.itemID) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + SetCriteriaProgress(achievementCriteria, 1); break; case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: // miscvalue1 = go entry @@ -1202,8 +1204,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM: - case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: - case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_TOTAL: break; // Not implemented yet :( } @@ -1360,6 +1360,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR: diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index f042f2551..1c5ec74eb 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -34,7 +34,7 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data) uint64 guid; recv_data >> guid; - sLog.outDebug("Inspect Arena stats " I64FMTD, guid); + sLog.outDebug("Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); if(Player *plr = objmgr.GetPlayer(guid)) { diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index d37b1b731..f65b863ad 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -606,7 +606,8 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); - //sLog.outDebug("Auctionhouse search guid: " I64FMTD ", list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", guid, listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); + //sLog.outDebug("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", + // GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data( SMSG_AUCTION_LIST_RESULT, (4+4+4) ); uint32 count = 0; diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index 3fdbcd378..ed8a05963 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -682,6 +682,6 @@ void AuctionEntry::SaveToDB() const { //No SQL injection (no strings) CharacterDatabase.PExecute("INSERT INTO auctionhouse (id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit) " - "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" I64FMTD "', '%u', '%u', '%u', '%u')", + "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u')", Id, auctioneer, item_guidlow, item_template, owner, buyout, (uint64)expire_time, bidder, bid, startbid, deposit); } diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index e2c513700..bc0b7a58e 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -465,7 +465,7 @@ void BattleGround::SendPacketToAll(WorldPacket *packet) if (plr) plr->GetSession()->SendPacket(packet); else - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); } } @@ -477,7 +477,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player * if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -509,7 +509,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -532,7 +532,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -552,7 +552,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID) if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -577,7 +577,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -676,7 +676,7 @@ void BattleGround::EndBattleGround(uint32 winner) else loser_arena_team->OfflineMemberLost(itr->first, winner_rating); } - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index efb62e627..7a63b6729 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -143,7 +143,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint() Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]); if (!plr) { - sLog.outError("BattleGroundEY: Player " I64FMTD " not found!", m_PlayersNearPoint[EY_POINTS_MAX][j]); + sLog.outError("BattleGroundEY: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); ++j; continue; } @@ -183,7 +183,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[i][j]); if (!plr) { - sLog.outError("BattleGroundEY: Player " I64FMTD " not found!", m_PlayersNearPoint[i][j]); + sLog.outError("BattleGroundEY: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); //move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 3bff36f18..04965cdbb 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -38,7 +38,7 @@ void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data ) uint64 guid; recv_data >> guid; - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from: " I64FMT, guid); + sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) @@ -93,7 +93,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from: " I64FMT, guid); + sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); // can do this, since it's battleground, not arena BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0); diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 74f6cae45..df9276fe4 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1188,7 +1188,7 @@ void BattleGroundMgr::Update(uint32 diff) { DistributeArenaPoints(); m_NextAutoDistributionTime = time_t(sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS)); - CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '"I64FMTD"'", uint64(m_NextAutoDistributionTime)); + CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '"UI64FMTD"'", uint64(m_NextAutoDistributionTime)); } m_AutoDistributionTimeChecker = 600000; // check 10 minutes } @@ -1760,7 +1760,7 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution() { sLog.outDebug("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now."); m_NextAutoDistributionTime = time_t(sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS)); - CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"I64FMTD"')", uint64(m_NextAutoDistributionTime)); + CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"UI64FMTD"')", uint64(m_NextAutoDistributionTime)); } else { diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 602656abe..e6100afd9 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -69,7 +69,7 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type,misc FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid)); - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" I64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid)); diff --git a/src/game/Chat.h b/src/game/Chat.h index d5e5c2619..7ba20206f 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -519,6 +519,7 @@ class ChatHandler bool HandleBanInfoHelper(uint32 accountid, char const* accountname); bool HandleUnBanHelper(BanMode mode,char const* args); void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel); + void HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id); void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; private: diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index cee3d9c15..0e4a86bef 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1869,10 +1869,33 @@ bool Creature::LoadCreaturesAddon(bool reload) Mount(cainfo->mount); if (cainfo->bytes1 != 0) - SetUInt32Value(UNIT_FIELD_BYTES_1, cainfo->bytes1); + { + // 0 StandState + // 1 FreeTalentPoints Pet only, so always 0 for default creature + // 2 StandFlags + // 3 StandMiscFlags + + SetByteValue(UNIT_FIELD_BYTES_1, 0, uint8(cainfo->bytes1 & 0xFF)); + //SetByteValue(UNIT_FIELD_BYTES_1, 1, uint8((cainfo->bytes1 >> 8) & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_1, 1, 0); + SetByteValue(UNIT_FIELD_BYTES_1, 2, uint8((cainfo->bytes1 >> 16) & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF)); + } if (cainfo->bytes2 != 0) - SetUInt32Value(UNIT_FIELD_BYTES_2, cainfo->bytes2); + { + // 0 SheathState + // 1 Bytes2Flags + // 2 UnitRename Pet only, so always 0 for default creature + // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura + + SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF)); + //SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_2, 2, 0); + //SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); + } if (cainfo->emote != 0) SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote); diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index bb4b5f139..e895595d1 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -412,12 +412,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: { - if (action.morph.creatireId || action.morph.modelId) + if (action.morph.creatureId || action.morph.modelId) { //set model based on entry from creature_template - if (action.morph.creatireId) + if (action.morph.creatureId) { - if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatireId)) + if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatureId)) { //use default display if (ci->DisplayID_A) @@ -521,12 +521,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 Creature* pCreature = NULL; if (action.summon.duration) - pCreature = m_creature->SummonCreature(action.summon.creatured, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration); + pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration); else - pCreature = m_creature->SummonCreature(action.summon.creatured, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); if (!pCreature) - sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatured, EventId, m_creature->GetEntry()); + sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry()); else if (action.summon.target != TARGET_T_SELF && target) pCreature->AI()->AttackStart(target); break; @@ -578,11 +578,19 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 MeleeEnabled = action.auto_attack.state != 0; break; case ACTION_T_COMBAT_MOVEMENT: + // ignore no affect case + if(CombatMovementEnabled==(action.combat_movement.state!=0)) + return; + CombatMovementEnabled = action.combat_movement.state != 0; //Allow movement (create new targeted movement gen only if idle) if (CombatMovementEnabled) { + if(action.combat_movement.melee && m_creature->isInCombat()) + if(Unit* victim = m_creature->getVictim()) + m_creature->SendMeleeAttackStart(victim); + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE) { m_creature->GetMotionMaster()->Clear(false); @@ -590,11 +598,17 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } } else - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) { - m_creature->GetMotionMaster()->Clear(false); - m_creature->GetMotionMaster()->MoveIdle(); - m_creature->StopMoving(); + if(action.combat_movement.melee && m_creature->isInCombat()) + if(Unit* victim = m_creature->getVictim()) + m_creature->SendMeleeAttackStop(victim); + + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + { + m_creature->GetMotionMaster()->Clear(false); + m_creature->GetMotionMaster()->MoveIdle(); + m_creature->StopMoving(); + } } break; case ACTION_T_SET_PHASE: diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index b5b98e0ca..ac97badd8 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -193,7 +193,7 @@ struct CreatureEventAI_Action // ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3 struct { - uint32 creatireId; // set one from fields (or 0 for both to demorph) + uint32 creatureId; // set one from fields (or 0 for both to demorph) uint32 modelId; } morph; // ACTION_T_SOUND = 4 @@ -230,7 +230,7 @@ struct CreatureEventAI_Action // ACTION_T_SUMMON = 12 struct { - uint32 creatured; + uint32 creatureId; uint32 target; uint32 duration; } summon; @@ -281,6 +281,7 @@ struct CreatureEventAI_Action struct { uint32 state; // 0 = stop combat based movement, anything else continue attacking + uint32 melee; // if set: at stop send melee combat stop if in combat, use for terminate melee fighting state for switch to ranged } combat_movement; // ACTION_T_SET_PHASE = 22 struct diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp index 5caaa2311..ef84ad5f1 100644 --- a/src/game/CreatureEventAIMgr.cpp +++ b/src/game/CreatureEventAIMgr.cpp @@ -438,19 +438,19 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } break; case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: - if (action.morph.creatireId !=0 || action.morph.modelId !=0) + if (action.morph.creatureId !=0 || action.morph.modelId !=0) { - if (action.morph.creatireId && !sCreatureStorage.LookupEntry(action.morph.creatireId)) + if (action.morph.creatureId && !sCreatureStorage.LookupEntry(action.morph.creatureId)) { - sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatireId); - action.morph.creatireId = 0; + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId); + action.morph.creatureId = 0; } if (action.morph.modelId) { - if (action.morph.creatireId) + if (action.morph.creatureId) { - sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId,action.morph.creatireId); + sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId,action.morph.creatureId); action.morph.modelId = 0; } else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId)) @@ -512,8 +512,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; } case ACTION_T_SUMMON: - if (!sCreatureStorage.LookupEntry(action.summon.creatured)) - sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatured); + if (!sCreatureStorage.LookupEntry(action.summon.creatureId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId); if (action.summon.target >= TARGET_T_END) sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index cc2df4b37..ebae610d4 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1240,7 +1240,7 @@ struct SkillLineEntry uint32 spellIcon; // 37 m_spellIconID //char* alternateVerb[16]; // 38-53 m_alternateVerb_lang // 54 string flags - // 55 m_canLink + uint32 canLink; // 55 m_canLink (prof. with recipes }; struct SkillLineAbilityEntry diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 85fbd4525..f541a9b17 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -77,7 +77,7 @@ const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii"; const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiii"; -const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxx"; +const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi"; const char SkillLineAbilityfmt[]="niiiixxiiiiixx"; const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellCastTimefmt[]="nixx"; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 484e5fde7..0e4cb4e87 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -105,7 +105,7 @@ bool Group::Create(const uint64 &guid, const char * name) CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("DELETE FROM group_member WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("INSERT INTO groups(leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty) " - "VALUES('%u','%u','%u','%u','%u','%u','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','%u','%u')", + "VALUES('%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u')", GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod), GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), m_difficulty); } diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index d16691be7..fc3a1f863 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -391,6 +391,16 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data ) // everything's fine, do it group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, Choise); + + switch (Choise) + { + case 1: + GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1); + break; + case 2: + GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1); + break; + } } void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data) diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index d97616270..a4c4a2657 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -82,7 +82,7 @@ bool Guild::create(Player* leader, std::string gname) CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", Id); CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid='%u'", Id); CharacterDatabase.PExecute("INSERT INTO guild (guildid,name,leaderguid,info,motd,createdate,EmblemStyle,EmblemColor,BorderStyle,BorderColor,BackgroundColor,BankMoney) " - "VALUES('%u','%s','%u', '%s', '%s', NOW(),'%u','%u','%u','%u','%u','" I64FMTD "')", + "VALUES('%u','%s','%u', '%s', '%s', NOW(),'%u','%u','%u','%u','%u','" UI64FMTD "')", Id, gname.c_str(), GUID_LOPART(leaderGuid), dbGINFO.c_str(), dbMOTD.c_str(), EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, guildbank_money); CharacterDatabase.CommitTransaction(); @@ -916,7 +916,7 @@ void Guild::LogGuildEvent(uint8 EventType, uint32 PlayerGuid1, uint32 PlayerGuid // Add entry to map m_GuildEventlog.push_back(NewEvent); // Add new eventlog entry into DB - CharacterDatabase.PExecute("INSERT INTO guild_eventlog (guildid, LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','" I64FMTD "')", + CharacterDatabase.PExecute("INSERT INTO guild_eventlog (guildid, LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','" UI64FMTD "')", Id, NewEvent->LogGuid, uint32(NewEvent->EventType), NewEvent->PlayerGuid1, NewEvent->PlayerGuid2, uint32(NewEvent->NewRank), NewEvent->TimeStamp); } @@ -1299,7 +1299,7 @@ void Guild::SetBankMoney(int64 money) money = 0; guildbank_money = money; - CharacterDatabase.PExecute("UPDATE guild SET BankMoney='" I64FMTD "' WHERE guildid='%u'", money, Id); + CharacterDatabase.PExecute("UPDATE guild SET BankMoney='" UI64FMTD "' WHERE guildid='%u'", money, Id); } // ************************************************* @@ -1665,7 +1665,7 @@ void Guild::LogBankEvent(uint8 LogEntry, uint8 TabId, uint32 PlayerGuidLow, uint } m_GuildBankEventLog_Item[TabId].push_back(NewEvent); } - CharacterDatabase.PExecute("INSERT INTO guild_bank_eventlog (guildid,LogGuid,LogEntry,TabId,PlayerGuid,ItemOrMoney,ItemStackCount,DestTabId,TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','%u','%u','" I64FMTD "')", + CharacterDatabase.PExecute("INSERT INTO guild_bank_eventlog (guildid,LogGuid,LogEntry,TabId,PlayerGuid,ItemOrMoney,ItemStackCount,DestTabId,TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "')", Id, NewEvent->LogGuid, uint32(NewEvent->LogEntry), uint32(TabId), NewEvent->PlayerGuid, NewEvent->ItemOrMoney, uint32(NewEvent->ItemStackCount), uint32(NewEvent->DestTabId), NewEvent->TimeStamp); } diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index f6f8060b4..193bb8e00 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -130,7 +130,7 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId) { // save the resettime for normal instances only when they get unloaded if(time_t resettime = itr->second->GetResetTimeForDB()) - CharacterDatabase.PExecute("UPDATE instance SET resettime = '"I64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId); + CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId); delete itr->second; m_instanceSaveById.erase(itr); } @@ -168,7 +168,7 @@ void InstanceSave::SaveToDB() } } - CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"I64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str()); + CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"UI64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str()); } time_t InstanceSave::GetResetTimeForDB() @@ -395,7 +395,7 @@ void InstanceSaveManager::LoadResetTimes() ResetTimeMapType::iterator itr = InstResetTime.find(instance); if(itr != InstResetTime.end() && itr->second.second != resettime) { - CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"I64FMTD"' WHERE id = '%u'", uint64(resettime), instance); + CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance); itr->second.second = resettime; } } @@ -430,7 +430,7 @@ void InstanceSaveManager::LoadResetTimes() uint64 oldresettime = fields[1].GetUInt64(); uint64 newresettime = (oldresettime / DAY) * DAY + diff; if(oldresettime != newresettime) - CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%u'", newresettime, mapid); + CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u'", newresettime, mapid); m_resetTimeByMapId[mapid] = newresettime; } while(result->NextRow()); @@ -439,7 +439,7 @@ void InstanceSaveManager::LoadResetTimes() // clean expired instances, references to them will be deleted in CleanupInstances // must be done before calculating new reset times - _DelHelper(CharacterDatabase, "id, map, difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map WHERE (instance.resettime < '"I64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"I64FMTD"')", (uint64)now, (uint64)now); + _DelHelper(CharacterDatabase, "id, map, difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map WHERE (instance.resettime < '"UI64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"UI64FMTD"')", (uint64)now, (uint64)now); // calculate new global reset times for expired instances and those that have never been reset yet // add the global reset times to the priority queue @@ -459,7 +459,7 @@ void InstanceSaveManager::LoadResetTimes() { // initialize the reset time t = today + period + diff; - CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','"I64FMTD"')", i, (uint64)t); + CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','"UI64FMTD"')", i, (uint64)t); } if(t < now) @@ -468,7 +468,7 @@ void InstanceSaveManager::LoadResetTimes() // calculate the next reset time t = (t / DAY) * DAY; t += ((today - t) / period + 1) * period + diff; - CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%u'", (uint64)t, i); + CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u'", (uint64)t, i); } m_resetTimeByMapId[temp->map] = t; @@ -611,7 +611,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe uint32 period = temp->reset_delay * DAY; uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff; // update it in the DB - CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%d'", next_reset, mapid); + CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d'", next_reset, mapid); } MapInstanced::InstancedMaps &instMaps = ((MapInstanced*)map)->GetInstancedMaps(); diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 699cb275b..dff44d6d0 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -642,7 +642,7 @@ bool ChatHandler::HandleModifyKnownTitlesCommand(const char* args) uint64 titles = 0; - sscanf((char*)args, I64FMTD, &titles); + sscanf((char*)args, UI64FMTD, &titles); Player *chr = getSelectedPlayer(); if (!chr) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 9282ccdb4..59f87dd7e 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -84,7 +84,7 @@ bool ChatHandler::HandleMuteCommand(const char* args) if (target) target->GetSession()->m_muteTime = mutetime; - loginDatabase.PExecute("UPDATE account SET mutetime = " I64FMTD " WHERE id = '%u'",uint64(mutetime), account_id ); + loginDatabase.PExecute("UPDATE account SET mutetime = " UI64FMTD " WHERE id = '%u'",uint64(mutetime), account_id ); if(target) ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime); @@ -3893,6 +3893,40 @@ bool ChatHandler::HandleCombatStopCommand(const char* args) return true; } +void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id) +{ + uint32 classmask = player->getClassMask(); + + for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + { + SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); + if (!skillLine) + continue; + + // wrong skill + if( skillLine->skillId != skill_id) + continue; + + // not high rank + if(skillLine->forward_spellid ) + continue; + + // skip racial skills + if (skillLine->racemask != 0) + continue; + + // skip wrong class skills + if( skillLine->classmask && (skillLine->classmask & classmask) == 0) + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); + if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,player,false)) + continue; + + player->learnSpell(skillLine->spellId,false); + } +} + bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) { uint32 classmask = m_session->GetPlayer()->getClassMask(); @@ -3903,31 +3937,10 @@ bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) if( !skillInfo ) continue; - if( skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY ) + if ((skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY) && + skillInfo->canLink) // only prof. with recipes have { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) - { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); - if( !skillLine ) - continue; - - // skip racial skills - if( skillLine->racemask != 0 ) - continue; - - // skip wrong class skills - if( skillLine->classmask && (skillLine->classmask & classmask) == 0) - continue; - - if( skillLine->skillId != i || skillLine->forward_spellid ) - continue; - - SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); - if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) - continue; - - m_session->GetPlayer()->learnSpell(skillLine->spellId,false); - } + HandleLearnSkillRecipesHelper(m_session->GetPlayer(),skillInfo->id); } } @@ -3960,54 +3973,58 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) uint32 classmask = m_session->GetPlayer()->getClassMask(); - for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) + std::string name; + + SkillLineEntry const *targetSkillInfo = NULL; + for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); - if( !skillInfo ) + if (!skillInfo) continue; - if( skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && - skillInfo->categoryId != SKILL_CATEGORY_SECONDARY ) + if ((skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && + skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) || + !skillInfo->canLink) // only prof with recipes have set continue; int loc = GetSessionDbcLocale(); - std::string name = skillInfo->name[loc]; + name = skillInfo->name[loc]; + if(name.empty()) + continue; - if(Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + loc = 0; + for(; loc < MAX_LOCALE; ++loc) { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); - if( !skillLine ) + if(loc==GetSessionDbcLocale()) continue; - if( skillLine->skillId != i || skillLine->forward_spellid ) + name = skillInfo->name[loc]; + if(name.empty()) continue; - // skip racial skills - if( skillLine->racemask != 0 ) - continue; - - // skip wrong class skills - if( skillLine->classmask && (skillLine->classmask & classmask) == 0) - continue; - - SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); - if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) - continue; - - if( !target->HasSpell(spellInfo->Id) ) - m_session->GetPlayer()->learnSpell(skillLine->spellId,false); + if (Utf8FitTo(name, wnamepart)) + break; } + } - uint16 maxLevel = target->GetPureMaxSkillValue(skillInfo->id); - target->SetSkill(skillInfo->id, maxLevel, maxLevel); - PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); - return true; + if(loc < MAX_LOCALE) + { + targetSkillInfo = skillInfo; + break; } } - return false; + if(!targetSkillInfo) + return false; + + HandleLearnSkillRecipesHelper(target,targetSkillInfo->id); + + uint16 maxLevel = target->GetPureMaxSkillValue(targetSkillInfo->id); + target->SetSkill(targetSkillInfo->id, maxLevel, maxLevel); + PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); + return true; } bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 72fe5946a..0d9079269 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -873,7 +873,7 @@ void WorldSession::SendMailTo(Player* receiver, uint8 messageType, uint8 station CharacterDatabase.BeginTransaction(); CharacterDatabase.escape_string(subject); CharacterDatabase.PExecute("INSERT INTO mail (id,messageType,stationery,mailTemplateId,sender,receiver,subject,itemTextId,has_items,expire_time,deliver_time,money,cod,checked) " - "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%u', '%u', '" I64FMTD "','" I64FMTD "', '%u', '%u', '%d')", + "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%u', '%u', '" UI64FMTD "','" UI64FMTD "', '%u', '%u', '%d')", mailId, messageType, stationery, mailTemplateId, sender_guidlow_or_entry, receiver_guidlow, subject.c_str(), itemTextId, (mi && !mi->empty() ? 1 : 0), (uint64)expire_time, (uint64)deliver_time, money, COD, checked); if(mi) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 66bf78e35..3882fdcfc 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -428,7 +428,7 @@ Map::Add(T *obj) if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { - sLog.outError("Map::Add: Object " I64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + sLog.outError("Map::Add: Object (GUID: %u TypeId: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -482,7 +482,7 @@ void Map::MessageBroadcast(WorldObject *obj, WorldPacket *msg) if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { - sLog.outError("Map::MessageBroadcast: Object " I64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + sLog.outError("Map::MessageBroadcast: Object (GUID: %u TypeId: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -527,7 +527,7 @@ void Map::MessageDistBroadcast(WorldObject *obj, WorldPacket *msg, float dist) if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { - sLog.outError("Map::MessageBroadcast: Object " I64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + sLog.outError("Map::MessageBroadcast: Object (GUID: %u TypeId: %u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -732,7 +732,7 @@ Map::Remove(T *obj, bool remove) CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { - sLog.outError("Map::Remove: Object " I64FMT " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + sLog.outError("Map::Remove: Object (GUID: %u TypeId:%u) have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -740,7 +740,7 @@ Map::Remove(T *obj, bool remove) if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) return; - DEBUG_LOG("Remove object " I64FMT " from grid[%u,%u]", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y); + DEBUG_LOG("Remove object (GUID: %u TypeId:%u) from grid[%u,%u]", obj->GetGUIDLow(), obj->GetTypeId(), cell.data.Part.grid_x, cell.data.Part.grid_y); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); assert( grid != NULL ); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 1993c90f0..95730eb6a 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1081,8 +1081,8 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket&/* recv_data*/) recv_data >> Orientation; // TODO for later may be we can use for anticheat - DEBUG_LOG("Guid " I64FMTD,guid); - DEBUG_LOG("unknown1 " I64FMTD,unknown1); + DEBUG_LOG("Guid " UI64FMTD,guid); + DEBUG_LOG("unknown1 " UI64FMTD,unknown1); DEBUG_LOG("unknown2 %u",unknown2); DEBUG_LOG("X %f",PositionX); DEBUG_LOG("Y %f",PositionY); @@ -1115,8 +1115,8 @@ void WorldSession::HandleMoveRootAck(WorldPacket&/* recv_data*/) recv_data >> Orientation; // for later may be we can use for anticheat - DEBUG_LOG("Guid " I64FMTD,guid); - DEBUG_LOG("unknown1 " I64FMTD,unknown1); + DEBUG_LOG("Guid " UI64FMTD,guid); + DEBUG_LOG("unknown1 " UI64FMTD,unknown1); DEBUG_LOG("unknown1 %u",unknown2); DEBUG_LOG("X %f",PositionX); DEBUG_LOG("Y %f",PositionY); @@ -1172,7 +1172,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) uint64 guid; recv_data >> guid; - DEBUG_LOG("Inspected guid is " I64FMTD, guid); + DEBUG_LOG("Inspected guid is (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); _player->SetSelection(guid); @@ -1406,7 +1406,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data ) sLog.outDebug("Removed FarSight from player %u", _player->GetGUIDLow()); break; case 1: - sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetFarSight(), _player->GetGUIDLow()); + sLog.outDebug("Added FarSight (GUID:%u TypeId:%u) to player %u", GUID_LOPART(_player->GetFarSight()), GuidHigh2TypeId(GUID_HIPART(_player->GetFarSight())), _player->GetGUIDLow()); break; } } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index a3fabb545..a49f939d6 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -171,7 +171,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) recv_data >> guid; recv_data >> flags >> time; - DEBUG_LOG("Guid " I64FMTD,guid); + DEBUG_LOG("Guid " UI64FMTD,guid); DEBUG_LOG("Flags %u, time %u",flags, time/IN_MILISECONDS); Unit *mover = _player->m_mover; diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 43d0a68f6..c13ce8f61 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -89,7 +89,7 @@ Object::~Object( ) if(IsInWorld()) { ///- Do NOT call RemoveFromWorld here, if the object is a player it will crash - sLog.outError("Object::~Object - guid="I64FMTD", typeid=%d deleted but still in world!!", GetGUID(), GetTypeId()); + sLog.outError("Object::~Object (GUID: %u TypeId: %u) deleted but still in world!!", GetGUIDLow(), GetTypeId()); //assert(0); } diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index e034cbf94..60a49cd7c 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -125,7 +125,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::SingletonGetPositionX(),obj->GetPositionY()); if(q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { - sLog.outError("ObjectAccessor::GetObjecInWorld: object "I64FMTD" has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); + sLog.outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); return NULL; } diff --git a/src/game/ObjectDefines.h b/src/game/ObjectDefines.h index ea2392aee..c092f1099 100644 --- a/src/game/ObjectDefines.h +++ b/src/game/ObjectDefines.h @@ -23,8 +23,8 @@ // used for creating values for respawn for example #define MAKE_PAIR64(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) ) -#define PAIR64_HIPART(x) (uint32)((uint64(x) >> 32) & 0x00000000FFFFFFFFLL) -#define PAIR64_LOPART(x) (uint32)(uint64(x) & 0x00000000FFFFFFFFLL) +#define PAIR64_HIPART(x) (uint32)((uint64(x) >> 32) & UI64LIT(0x00000000FFFFFFFF)) +#define PAIR64_LOPART(x) (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF)) #define MAKE_PAIR32(l, h) uint32( uint16(l) | ( uint32(h) << 16 ) ) #define PAIR32_HIPART(x) (uint16)((uint32(x) >> 16) & 0x0000FFFF) @@ -70,9 +70,9 @@ enum HighGuid // We have different low and middle part size for different guid types #define _GUID_ENPART_2(x) 0 -#define _GUID_ENPART_3(x) (uint32)((uint64(x) >> 24) & 0x0000000000FFFFFFLL) -#define _GUID_LOPART_2(x) (uint32)(uint64(x) & 0x00000000FFFFFFFFLL) -#define _GUID_LOPART_3(x) (uint32)(uint64(x) & 0x0000000000FFFFFFLL) +#define _GUID_ENPART_3(x) (uint32)((uint64(x) >> 24) & UI64LIT(0x0000000000FFFFFF)) +#define _GUID_LOPART_2(x) (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF)) +#define _GUID_LOPART_3(x) (uint32)(uint64(x) & UI64LIT(0x0000000000FFFFFF)) inline bool IsGuidHaveEnPart(uint64 const& guid) { diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 707b97061..c41607065 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -724,6 +724,15 @@ void ObjectMgr::LoadCreatureAddons() if(!addon) continue; + if (addon->mount) + { + if (!sCreatureDisplayInfoStore.LookupEntry(addon->mount)) + sLog.outErrorDb("Creature (Entry %u) have invalid displayInfoId for mount (%u) defined in `creature_template_addon`.",addon->guidOrEntry, addon->mount); + } + + if (!sEmotesStore.LookupEntry(addon->emote)) + sLog.outErrorDb("Creature (Entry %u) have invalid emote (%u) defined in `creature_template_addon`.",addon->guidOrEntry, addon->emote); + ConvertCreatureAddonAuras(const_cast(addon), "creature_template_addon", "Entry"); if(!sCreatureStorage.LookupEntry(addon->guidOrEntry)) @@ -742,6 +751,15 @@ void ObjectMgr::LoadCreatureAddons() if(!addon) continue; + if (addon->mount) + { + if (!sCreatureDisplayInfoStore.LookupEntry(addon->mount)) + sLog.outErrorDb("Creature (GUID %u) have invalid displayInfoId for mount (%u) defined in `creature_addon`.",addon->guidOrEntry, addon->mount); + } + + if (!sEmotesStore.LookupEntry(addon->emote)) + sLog.outErrorDb("Creature (GUID %u) have invalid emote (%u) defined in `creature_addon`.",addon->guidOrEntry, addon->emote); + ConvertCreatureAddonAuras(const_cast(addon), "creature_addon", "GUIDLow"); if(mCreatureDataMap.find(addon->guidOrEntry)==mCreatureDataMap.end()) @@ -4283,9 +4301,9 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) sLog.outDebug("Returning mails current time: hour: %d, minute: %d, second: %d ", localtime(&basetime)->tm_hour, localtime(&basetime)->tm_min, localtime(&basetime)->tm_sec); //delete all old mails without item and without body immediately, if starting server if (!serverUp) - CharacterDatabase.PExecute("DELETE FROM mail WHERE expire_time < '" I64FMTD "' AND has_items = '0' AND itemTextId = 0", (uint64)basetime); + CharacterDatabase.PExecute("DELETE FROM mail WHERE expire_time < '" UI64FMTD "' AND has_items = '0' AND itemTextId = 0", (uint64)basetime); // 0 1 2 3 4 5 6 7 8 9 - QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" I64FMTD "'", (uint64)basetime); + QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" UI64FMTD "'", (uint64)basetime); if ( !result ) { barGoLink bar(1); @@ -4360,7 +4378,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) else { //mail will be returned: - CharacterDatabase.PExecute("UPDATE mail SET sender = '%u', receiver = '%u', expire_time = '" I64FMTD "', deliver_time = '" I64FMTD "',cod = '0', checked = '%u' WHERE id = '%u'", m->receiver, m->sender, (uint64)(basetime + 30*DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID); + CharacterDatabase.PExecute("UPDATE mail SET sender = '%u', receiver = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',cod = '0', checked = '%u' WHERE id = '%u'", m->receiver, m->sender, (uint64)(basetime + 30*DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID); delete m; continue; } @@ -6030,7 +6048,7 @@ void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t mCreatureRespawnTimes[MAKE_PAIR64(loguid,instance)] = t; WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE guid = '%u' AND instance = '%u'", loguid, instance); if(t) - WorldDatabase.PExecute("INSERT INTO creature_respawn VALUES ( '%u', '" I64FMTD "', '%u' )", loguid, uint64(t), instance); + WorldDatabase.PExecute("INSERT INTO creature_respawn VALUES ( '%u', '" UI64FMTD "', '%u' )", loguid, uint64(t), instance); } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -6048,7 +6066,7 @@ void ObjectMgr::SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t) mGORespawnTimes[MAKE_PAIR64(loguid,instance)] = t; WorldDatabase.PExecute("DELETE FROM gameobject_respawn WHERE guid = '%u' AND instance = '%u'", loguid, instance); if(t) - WorldDatabase.PExecute("INSERT INTO gameobject_respawn VALUES ( '%u', '" I64FMTD "', '%u' )", loguid, uint64(t), instance); + WorldDatabase.PExecute("INSERT INTO gameobject_respawn VALUES ( '%u', '" UI64FMTD "', '%u' )", loguid, uint64(t), instance); } void ObjectMgr::DeleteRespawnTimeForInstance(uint32 instance) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 99e420e20..40a19b95f 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1077,7 +1077,7 @@ void Pet::_SaveSpellCooldowns() m_CreatureSpellCooldowns.erase(itr++); else { - CharacterDatabase.PExecute("INSERT INTO pet_spell_cooldown (guid,spell,time) VALUES ('%u', '%u', '" I64FMTD "')", m_charmInfo->GetPetNumber(), itr->first, uint64(itr->second)); + CharacterDatabase.PExecute("INSERT INTO pet_spell_cooldown (guid,spell,time) VALUES ('%u', '%u', '" UI64FMTD "')", m_charmInfo->GetPetNumber(), itr->first, uint64(itr->second)); ++itr; } } @@ -1250,7 +1250,7 @@ void Pet::_SaveAuras() if (i == 3) { CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) " - "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%u', '%d', '%d', '%d', '%d')", + "VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%u', '%d', '%d', '%d', '%d')", m_charmInfo->GetPetNumber(), itr2->second->GetCasterGUID(),(uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), stackCounter, itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges())); } } diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 103f2a59d..2e6433311 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -66,7 +66,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) CharmInfo *charmInfo = pet->GetCharmInfo(); if(!charmInfo) { - sLog.outError("WorldSession::HandlePetAction: object "I64FMTD" is considered pet-like but doesn't have a charminfo!", pet->GetGUID()); + sLog.outError("WorldSession::HandlePetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -344,7 +344,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) CharmInfo *charmInfo = pet->GetCharmInfo(); if(!charmInfo) { - sLog.outError("WorldSession::HandlePetSetAction: object "I64FMTD" is considered pet-like but doesn't have a charminfo!", pet->GetGUID()); + sLog.outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -515,7 +515,7 @@ void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket) CharmInfo *charmInfo = pet->GetCharmInfo(); if(!charmInfo) { - sLog.outError("WorldSession::HandlePetUnlearnOpcode: object "I64FMTD" is considered pet-like but doesn't have a charminfo!", pet->GetGUID()); + sLog.outError("WorldSession::HandlePetUnlearnOpcode: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } pet->resetTalents(); @@ -554,7 +554,7 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ) CharmInfo *charmInfo = pet->GetCharmInfo(); if(!charmInfo) { - sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object "I64FMTD" is considered pet-like but doesn't have a charminfo!", pet->GetGUID()); + sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 0090d4f67..56c2c1215 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3354,7 +3354,7 @@ void Player::_SaveSpellCooldowns() m_spellCooldowns.erase(itr++); else if(itr->second.end <= infTime) // not save locked cooldowns, it will be reset or set at reload { - CharacterDatabase.PExecute("INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES ('%u', '%u', '%u', '" I64FMTD "')", GetGUIDLow(), itr->first, itr->second.itemid, uint64(itr->second.end)); + CharacterDatabase.PExecute("INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES ('%u', '%u', '%u', '" UI64FMTD "')", GetGUIDLow(), itr->first, itr->second.itemid, uint64(itr->second.end)); ++itr; } else @@ -10316,6 +10316,8 @@ void Player::QuickEquipItem( uint16 pos, Item *pItem) pItem->AddToWorld(); pItem->SendUpdateToPlayer( this ); } + + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); } } @@ -14793,7 +14795,7 @@ void Player::_LoadMailedItems(Mail *mail) void Player::_LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery) { //set a count of unread mails - //QueryResult *resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" I64FMTD "'", GUID_LOPART(playerGuid),(uint64)cTime); + //QueryResult *resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(playerGuid),(uint64)cTime); if (resultUnread) { Field *fieldMail = resultUnread->Fetch(); @@ -15572,7 +15574,7 @@ void Player::_SaveAuras() if (i == 3) { CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) " - "VALUES ('%u', '" I64FMTD "' ,'%u', '%u', '%u', '%d', '%d', '%d', '%d')", + "VALUES ('%u', '" UI64FMTD "' ,'%u', '%u', '%u', '%d', '%d', '%d', '%d')", GetGUIDLow(), itr2->second->GetCasterGUID(), (uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), stackCounter, itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges())); } } @@ -15679,7 +15681,7 @@ void Player::_SaveMail() Mail *m = (*itr); if (m->state == MAIL_STATE_CHANGED) { - CharacterDatabase.PExecute("UPDATE mail SET itemTextId = '%u',has_items = '%u',expire_time = '" I64FMTD "', deliver_time = '" I64FMTD "',money = '%u',cod = '%u',checked = '%u' WHERE id = '%u'", + CharacterDatabase.PExecute("UPDATE mail SET itemTextId = '%u',has_items = '%u',expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',money = '%u',cod = '%u',checked = '%u' WHERE id = '%u'", m->itemTextId, m->HasItems() ? 1 : 0, (uint64)m->expire_time, (uint64)m->deliver_time, m->money, m->COD, m->checked, m->messageID); if(m->removedItems.size()) { @@ -15727,11 +15729,11 @@ void Player::_SaveQuestStatus() { case QUEST_NEW : CharacterDatabase.PExecute("INSERT INTO character_queststatus (guid,quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4) " - "VALUES ('%u', '%u', '%u', '%u', '%u', '" I64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", + "VALUES ('%u', '%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", GetGUIDLow(), i->first, i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / IN_MILISECONDS+ sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3]); break; case QUEST_CHANGED : - CharacterDatabase.PExecute("UPDATE character_queststatus SET status = '%u',rewarded = '%u',explored = '%u',timer = '" I64FMTD "',mobcount1 = '%u',mobcount2 = '%u',mobcount3 = '%u',mobcount4 = '%u',itemcount1 = '%u',itemcount2 = '%u',itemcount3 = '%u',itemcount4 = '%u' WHERE guid = '%u' AND quest = '%u' ", + CharacterDatabase.PExecute("UPDATE character_queststatus SET status = '%u',rewarded = '%u',explored = '%u',timer = '" UI64FMTD "',mobcount1 = '%u',mobcount2 = '%u',mobcount3 = '%u',mobcount4 = '%u',itemcount1 = '%u',itemcount2 = '%u',itemcount3 = '%u',itemcount4 = '%u' WHERE guid = '%u' AND quest = '%u' ", i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / IN_MILISECONDS + sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3], GetGUIDLow(), i->first ); break; case QUEST_UNCHANGED: @@ -15754,7 +15756,7 @@ void Player::_SaveDailyQuestStatus() CharacterDatabase.PExecute("DELETE FROM character_queststatus_daily WHERE guid = '%u'",GetGUIDLow()); for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) if(GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)) - CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest,time) VALUES ('%u', '%u','" I64FMTD "')", + CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest,time) VALUES ('%u', '%u','" UI64FMTD "')", GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx),uint64(m_lastDailyQuestTime)); } @@ -16420,7 +16422,7 @@ void Player::PossessSpellInitialize() if(!charmInfo) { - sLog.outError("Player::PossessSpellInitialize(): charm ("I64FMTD") has no charminfo!", charm->GetGUID()); + sLog.outError("Player::PossessSpellInitialize(): charm (GUID: %u TypeId: %u) has no charminfo!", charm->GetGUIDLow(),charm->GetTypeId()); return; } @@ -16448,7 +16450,7 @@ void Player::CharmSpellInitialize() CharmInfo *charmInfo = charm->GetCharmInfo(); if(!charmInfo) { - sLog.outError("Player::CharmSpellInitialize(): the player's charm ("I64FMTD") has no charminfo!", charm->GetGUID()); + sLog.outError("Player::CharmSpellInitialize(): the player's charm (GUID: %u TypeId: %u) has no charminfo!", charm->GetGUIDLow(),charm->GetTypeId()); return; } @@ -18844,8 +18846,9 @@ uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const void Player::ResurectUsingRequestData() { - /// Teleport before resurrecting, otherwise the player might get attacked from creatures near his corpse - TeleportTo(m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, GetOrientation()); + /// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse + if(IS_PLAYER_GUID(m_resurrectGUID)) + TeleportTo(m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, GetOrientation()); ResurrectPlayer(0.0f,false); @@ -19909,9 +19912,9 @@ void Player::UpdateKnownCurrencies(uint32 itemId, bool apply) if(CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemId)) { if(apply) - SetFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(1LL << (ctEntry->BitIndex-1))); + SetFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(UI64LIT(1) << (ctEntry->BitIndex-1))); else - RemoveFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(1LL << (ctEntry->BitIndex-1))); + RemoveFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(UI64LIT(1) << (ctEntry->BitIndex-1))); } } diff --git a/src/game/Player.h b/src/game/Player.h index 7d0858dda..655986cf0 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -403,48 +403,48 @@ enum PlayerFlags // used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<SpellFamilyName) { case SPELLFAMILY_MAGE: // Arcane Missles / Blizzard triggers need do it - if (m_spellInfo->SpellFamilyFlags & 0x0000000000200080LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000200080)) m_canTrigger = true; break; case SPELLFAMILY_WARLOCK: // For Hellfire Effect / Rain of Fire / Seed of Corruption triggers need do it - if (m_spellInfo->SpellFamilyFlags & 0x0000800000000060LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000060)) m_canTrigger = true; break; case SPELLFAMILY_PRIEST: // For Penance heal/damage triggers need do it - if (m_spellInfo->SpellFamilyFlags & 0x0001800000000000LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0001800000000000)) m_canTrigger = true; break; case SPELLFAMILY_ROGUE: // For poisons need do it - if (m_spellInfo->SpellFamilyFlags & 0x000000101001E000LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x000000101001E000)) m_canTrigger = true; break; case SPELLFAMILY_HUNTER: // Hunter Rapid Killing/Explosive Trap Effect/Immolation Trap Effect/Frost Trap Aura/Snake Trap Effect/Explosive Shot - if (m_spellInfo->SpellFamilyFlags & 0x0100200000000214LL || + if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0100200000000214)) || m_spellInfo->SpellFamilyFlags2 & 0x200) m_canTrigger = true; break; case SPELLFAMILY_PALADIN: // For Judgements (all) / Holy Shock triggers need do it - if (m_spellInfo->SpellFamilyFlags & 0x0001000900B80400LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0001000900B80400)) m_canTrigger = true; break; default: @@ -837,7 +837,7 @@ void Spell::prepareDataForTriggerSystem() } // Hunter traps spells (for Entrapment trigger) // Gives your Immolation Trap, Frost Trap, Explosive Trap, and Snake Trap .... - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellInfo->SpellFamilyFlags & 0x000020000000001CLL) + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x000020000000001C))) m_procAttacker |= PROC_FLAG_ON_TRAP_ACTIVATION; } @@ -894,7 +894,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) m_delayMoment = target.timeDelay; } else - target.timeDelay = 0LL; + target.timeDelay = UI64LIT(0); // If target reflect spell back to caster if (target.missCondition == SPELL_MISS_REFLECT) @@ -957,7 +957,7 @@ void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex) m_delayMoment = target.timeDelay; } else - target.timeDelay = 0LL; + target.timeDelay = UI64LIT(0); // Add target to list m_UniqueGOTargetInfo.push_back(target); @@ -1079,7 +1079,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) caster->DealSpellDamage(&damageInfo, true); // Judgement of Blood - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && m_spellInfo->SpellFamilyFlags & 0x0000000800000000LL && m_spellInfo->SpellIconID==153) + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000800000000)) && m_spellInfo->SpellIconID==153) { int32 damagePoint = damageInfo.damage * 33 / 100; m_caster->CastCustomSpell(m_caster, 32220, &damagePoint, NULL, NULL, true); @@ -1371,7 +1371,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) { case SPELLFAMILY_DRUID: // Starfall - if (m_spellInfo->SpellFamilyFlags2 & 0x00000100LL) + if (m_spellInfo->SpellFamilyFlags2 & UI64LIT(0x00000100)) unMaxTargets = 2; break; default: @@ -2393,7 +2393,8 @@ void Spell::cast(bool skipCheck) } case SPELLFAMILY_MAGE: { - if (m_spellInfo->SpellFamilyFlags&0x0000008000000000LL) // Ice Block + // Ice Block + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000008000000000)) m_preCastSpell = 41425; // Hypothermia break; } @@ -2408,7 +2409,8 @@ void Spell::cast(bool skipCheck) } case SPELLFAMILY_PALADIN: { - if (m_spellInfo->SpellFamilyFlags&0x0000000000400080LL) // Divine Shield, Divine Protection or Hand of Protection + // Divine Shield, Divine Protection or Hand of Protection + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400080)) m_preCastSpell = 25771; // Forbearance break; } @@ -3860,9 +3862,8 @@ SpellCastResult Spell::CheckCast(bool strict) { //Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags //Exclusion for Mutilate:Facing Limitation was removed in 2.0.1 and 3.0.3, but they still use the same, old Ex-Flags - if( (m_spellInfo->SpellFamilyName != SPELLFAMILY_DRUID || m_spellInfo->SpellFamilyFlags != 0x0000000000020000LL) && - (m_spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || m_spellInfo->SpellFamilyFlags != 0x0020000000000000LL) - ) + if ((m_spellInfo->SpellFamilyName != SPELLFAMILY_DRUID || (m_spellInfo->SpellFamilyFlags != UI64LIT(0x0000000000020000))) && + (m_spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || (m_spellInfo->SpellFamilyFlags != UI64LIT(0x0020000000000000)))) { SendInterrupted(2); return SPELL_FAILED_NOT_BEHIND; @@ -5379,7 +5380,7 @@ bool Spell::CheckTargetCreatureType(Unit* target) const uint32 spellCreatureTargetMask = m_spellInfo->TargetCreatureType; // Curse of Doom : not find another way to fix spell target check :/ - if(m_spellInfo->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags == 0x0200000000LL) + if(m_spellInfo->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags == UI64LIT(0x0200000000)) { // not allow cast at player if(target->GetTypeId()==TYPEID_PLAYER) diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index 757390104..bd1913867 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -88,11 +88,11 @@ enum AuraType SPELL_AURA_PROC_TRIGGER_DAMAGE = 43, SPELL_AURA_TRACK_CREATURES = 44, SPELL_AURA_TRACK_RESOURCES = 45, - SPELL_AURA_46 = 46, // Ignore all Gear test spells + SPELL_AURA_46 = 46, // Ignore all Gear test spells SPELL_AURA_MOD_PARRY_PERCENT = 47, - SPELL_AURA_48 = 48, // One periodic spell + SPELL_AURA_48 = 48, // One periodic spell SPELL_AURA_MOD_DODGE_PERCENT = 49, - SPELL_AURA_MOD_CRITICAL_HEALING_BONUS = 50, + SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT = 50, SPELL_AURA_MOD_BLOCK_PERCENT = 51, SPELL_AURA_MOD_CRIT_PERCENT = 52, SPELL_AURA_PERIODIC_LEECH = 53, @@ -132,7 +132,7 @@ enum AuraType SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN = 87, SPELL_AURA_MOD_HEALTH_REGEN_PERCENT = 88, SPELL_AURA_PERIODIC_DAMAGE_PERCENT = 89, - SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE + SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE SPELL_AURA_MOD_DETECT_RANGE = 91, SPELL_AURA_PREVENTS_FLEEING = 92, SPELL_AURA_MOD_UNATTACKABLE = 93, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index d35360472..9d57a2947 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -100,7 +100,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleAuraModParryPercent, // 47 SPELL_AURA_MOD_PARRY_PERCENT &Aura::HandleNULL, // 48 SPELL_AURA_48 spell Napalm (area damage spell with additional delayed damage effect) &Aura::HandleAuraModDodgePercent, // 49 SPELL_AURA_MOD_DODGE_PERCENT - &Aura::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_BONUS + &Aura::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT implemented in Unit::SpellCriticalHealingBonus &Aura::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT &Aura::HandleAuraModCritPercent, // 52 SPELL_AURA_MOD_CRIT_PERCENT &Aura::HandlePeriodicLeech, // 53 SPELL_AURA_PERIODIC_LEECH @@ -989,19 +989,19 @@ void Aura::_AddAura() m_target->ModifyAuraState(AURA_STATE_IMMOLATE, true); // Faerie Fire (druid versions) - if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags & 0x0000000000000400LL) + if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000400))) m_target->ModifyAuraState(AURA_STATE_FAERIE_FIRE, true); // Victorious - if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags & 0x0004000000000000LL) + if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && (m_spellProto->SpellFamilyFlags & UI64LIT(0x0004000000000000))) m_target->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH, true); // Swiftmend state on Regrowth & Rejuvenation - if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && m_spellProto->SpellFamilyFlags & 0x50 ) + if (m_spellProto->SpellFamilyName == SPELLFAMILY_DRUID && (m_spellProto->SpellFamilyFlags & UI64LIT(0x50))) m_target->ModifyAuraState(AURA_STATE_SWIFTMEND, true); // Deadly poison aura state - if(m_spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && m_spellProto->SpellFamilyFlags & 0x10000) + if(m_spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && (m_spellProto->SpellFamilyFlags & UI64LIT(0x10000))) m_target->ModifyAuraState(AURA_STATE_DEADLY_POISON, true); // Enrage aura state @@ -1089,28 +1089,28 @@ void Aura::_RemoveAura() removeState = AURA_STATE_JUDGEMENT; // Update Seals information break; case SPELLFAMILY_WARLOCK: - if(m_spellProto->SpellFamilyFlags & 4) + if(m_spellProto->SpellFamilyFlags & UI64LIT(0x4)) removeState = AURA_STATE_IMMOLATE; // Conflagrate aura state break; case SPELLFAMILY_DRUID: - if(m_spellProto->SpellFamilyFlags & 0x0000000000000400LL) + if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000400)) removeState = AURA_STATE_FAERIE_FIRE; // Faerie Fire (druid versions) - else if(m_spellProto->SpellFamilyFlags & 0x50) + else if(m_spellProto->SpellFamilyFlags & UI64LIT(0x50)) { removeFamilyFlag = 0x50; removeState = AURA_STATE_SWIFTMEND; // Swiftmend aura state } break; case SPELLFAMILY_WARRIOR: - if(m_spellProto->SpellFamilyFlags & 0x0004000000000000LL) + if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0004000000000000)) removeState = AURA_STATE_WARRIOR_VICTORY_RUSH; // Victorious break; case SPELLFAMILY_ROGUE: - if(m_spellProto->SpellFamilyFlags & 0x10000) + if(m_spellProto->SpellFamilyFlags & UI64LIT(0x10000)) removeState = AURA_STATE_DEADLY_POISON; // Deadly poison aura state break; case SPELLFAMILY_HUNTER: - if(m_spellProto->SpellFamilyFlags & 0x1000000000000000LL) + if(m_spellProto->SpellFamilyFlags & UI64LIT(0x1000000000000000)) removeState = AURA_STATE_FAERIE_FIRE; // Sting (hunter versions) } @@ -1301,7 +1301,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) ((Player*)m_target)->AddSpellMod(m_spellmod, apply); // reapply some passive spells after add/remove related spellmods - if(m_spellProto->SpellFamilyName==SPELLFAMILY_WARRIOR && (spellFamilyMask & 0x0000100000000000LL)) + if(m_spellProto->SpellFamilyName==SPELLFAMILY_WARRIOR && (spellFamilyMask & UI64LIT(0x0000100000000000))) { m_target->RemoveAurasDueToSpell(45471); @@ -1916,7 +1916,7 @@ void Aura::TriggerSpell() { SpellEntry const* spell = itr->second->GetSpellProto(); if( spell->SpellFamilyName == SPELLFAMILY_SHAMAN && - spell->SpellFamilyFlags & 0x0000000000000400L) + (spell->SpellFamilyFlags & UI64LIT(0x0000000000000400))) return; } target->RemoveAurasDueToSpell(28820); @@ -2083,7 +2083,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } // Earth Shield - if ( caster && GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && (GetSpellProto()->SpellFamilyFlags & 0x40000000000LL)) + if ( caster && GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x40000000000))) { // prevent double apply bonuses if(m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()) @@ -2164,14 +2164,14 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { // Stop caster Arcane Missle chanelling on death if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && - m_spellProto->SpellFamilyFlags&0x0000000000000800LL) + (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000800))) { caster->InterruptSpell(CURRENT_CHANNELED_SPELL); return; } // Stop caster Penance chanelling on death if (m_spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && - m_spellProto->SpellFamilyFlags2 & 0x00000080) + (m_spellProto->SpellFamilyFlags2 & UI64LIT(0x00000080))) { caster->InterruptSpell(CURRENT_CHANNELED_SPELL); return; @@ -2297,8 +2297,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real) mod->value = m_modifier.m_amount; mod->type = SPELLMOD_PCT; mod->spellId = GetId(); - mod->mask = 0x0000200000000000LL; - mod->mask2= 0LL; + mod->mask = UI64LIT(0x0000200000000000); + mod->mask2= UI64LIT(0x0); m_spellmod = mod; } ((Player*)m_target)->AddSpellMod(m_spellmod, apply); @@ -2323,8 +2323,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real) mod->value = m_modifier.m_amount/7; mod->type = SPELLMOD_FLAT; mod->spellId = GetId(); - mod->mask = 0x001000000000LL; - mod->mask2= 0LL; + mod->mask = UI64LIT(0x001000000000); + mod->mask2= UI64LIT(0x0); m_spellmod = mod; } @@ -2349,7 +2349,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } // Lifebloom - if ( GetSpellProto()->SpellFamilyFlags & 0x1000000000LL ) + if (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x1000000000)) { if ( apply ) { @@ -2368,7 +2368,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) Unit::AuraList auras = m_target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::iterator itr = auras.begin(); itr!=auras.end(); ++itr) if((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && - (*itr)->GetSpellProto()->SpellFamilyFlags & 0x1000000000LL) + ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x1000000000))) return; // final heal @@ -2406,12 +2406,14 @@ void Aura::HandleAuraDummy(bool apply, bool Real) switch (m_effIndex) { case 0: - mod->mask = 0x00200000000LL; // Windfury Totem - mod->mask2= 0LL; + // Windfury Totem + mod->mask = UI64LIT(0x00200000000); + mod->mask2= UI64LIT(0x0); break; case 1: - mod->mask = 0x00400000000LL; // Flametongue Totem - mod->mask2= 0LL; + // Flametongue Totem + mod->mask = UI64LIT(0x00400000000); + mod->mask2= UI64LIT(0x0); break; } @@ -3273,7 +3275,7 @@ void Aura::HandleModCharm(bool apply, bool Real) if(m_target->GetCharmInfo()) m_target->GetCharmInfo()->SetPetNumber(0, true); else - sLog.outError("Aura::HandleModCharm: target="I64FMTD" with typeid=%d has a charm aura but no charm info!", m_target->GetGUID(), m_target->GetTypeId()); + sLog.outError("Aura::HandleModCharm: target (GUID: %u TypeId: %u) has a charm aura but no charm info!", m_target->GetGUIDLow(), m_target->GetTypeId()); } } @@ -3414,7 +3416,10 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if(m_target->GetTypeId() != TYPEID_PLAYER) ((Creature*)m_target)->StopMoving(); else + { ((Player*)m_target)->m_movementInfo.flags = 0; // Clear movement flags + m_target->SetStandState(UNIT_STAND_STATE_STAND); + } WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8); data.append(m_target->GetPackGUID()); @@ -3481,7 +3486,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) } // Wyvern Sting - if (m_spellProto->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellProto->SpellFamilyFlags & 0x0000100000000000LL) + if (m_spellProto->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellProto->SpellFamilyFlags & UI64LIT(0x0000100000000000)) { Unit* caster = GetCaster(); if( !caster || caster->GetTypeId()!=TYPEID_PLAYER ) @@ -3552,7 +3557,7 @@ void Aura::HandleModStealth(bool apply, bool Real) pTarget->CastCustomSpell(pTarget,31665,&bp,NULL,NULL,true); } // Overkill - else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & 0x0000000000400000LL) + else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000)) { pTarget->RemoveAurasDueToSpell(58428); pTarget->CastSpell(pTarget, 58427, true); @@ -3592,7 +3597,7 @@ void Aura::HandleModStealth(bool apply, bool Real) if ((*i)->GetSpellProto()->SpellIconID == 2114) pTarget->CastSpell(pTarget, 31666, true); // Overkill - else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & 0x0000000000400000LL) + else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000)) pTarget->CastSpell(pTarget, 58428, true); } } @@ -4268,7 +4273,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_WARRIOR: { // Rend - if (m_spellProto->SpellFamilyFlags & 0x0000000000000020LL) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000020)) { // $0.2*(($MWB+$mwb)/2+$AP/14*$MWS) bonus per tick float ap = caster->GetTotalAttackPowerValue(BASE_ATTACK); @@ -4283,21 +4288,21 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_DRUID: { // Rake - if (m_spellProto->SpellFamilyFlags & 0x0000000000001000LL) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000001000)) { // $AP*0.06 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 6 / 100); return; } // Lacerate - if (m_spellProto->SpellFamilyFlags & 0x000000010000000000LL) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000010000000000)) { // $AP*0.05/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); return; } // Rip - if (m_spellProto->SpellFamilyFlags & 0x000000000000800000LL) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000800000)) { // 0.01*$AP*cp if (caster->GetTypeId() != TYPEID_PLAYER) @@ -4319,7 +4324,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) return; } // Lock Jaw - if (m_spellProto->SpellFamilyFlags & 0x1000000000000000LL) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x1000000000000000)) { // 0.15*$AP m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100); @@ -4330,7 +4335,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_ROGUE: { // Rupture - if (m_spellProto->SpellFamilyFlags & 0x000000000000100000LL) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000100000)) { if (caster->GetTypeId() != TYPEID_PLAYER) return; @@ -4346,14 +4351,14 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) return; } // Garrote - if (m_spellProto->SpellFamilyFlags & 0x000000000000000100LL) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x000000000000000100)) { // $AP*0.07 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100); return; } // Deadly Poison - if (m_spellProto->SpellFamilyFlags & 0x0000000000010000) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000010000)) { // 0.08*$AP / 4 * amount of stack m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 2 * GetStackAmount() / 100); @@ -4364,14 +4369,14 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) case SPELLFAMILY_HUNTER: { // Serpent Sting - if (m_spellProto->SpellFamilyFlags & 0x0000000000004000LL) + if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { // $RAP*0.1/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); return; } // Immolation Trap - if (m_spellProto->SpellFamilyFlags & 0x0000000000000004LL && m_spellProto->SpellIconID == 678) + if ((m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004)) && m_spellProto->SpellIconID == 678) { // $RAP*0.1/5 bonus per tick m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500); @@ -5595,7 +5600,7 @@ void Aura::HandleSpiritOfRedemption( bool apply, bool Real ) void Aura::CleanupTriggeredSpells() { - if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && m_spellProto->SpellFamilyFlags & 0x0000001000000020LL) + if (m_spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR && (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000001000000020))) { // Blood Frenzy remove m_target->RemoveAurasDueToSpell(30069); @@ -5644,7 +5649,9 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) } break; case SPELLFAMILY_MAGE: - if(m_spellProto->SpellFamilyFlags == 0x80100 || m_spellProto->SpellFamilyFlags == 0x8 || m_spellProto->SpellFamilyFlags == 0x100000000LL) + if (m_spellProto->SpellFamilyFlags == UI64LIT(0x80100) || + m_spellProto->SpellFamilyFlags == UI64LIT(0x8) || + m_spellProto->SpellFamilyFlags == UI64LIT(0x100000000)) { //frost ward, fire ward, ice barrier //+10% from +spd bonus @@ -5751,7 +5758,7 @@ void Aura::PeriodicTick() pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount()); // Curse of Agony damage-per-tick calculation - if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & 0x0000000000000400LL) && GetSpellProto()->SpellIconID==544) + if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000400)) && GetSpellProto()->SpellIconID==544) { // 1..4 ticks, 1/2 from normal tick damage if (m_duration >= ((m_maxduration-m_modifier.periodictime) * 2 / 3)) @@ -6462,7 +6469,7 @@ void Aura::PeriodicDummyTick() case SPELLFAMILY_HUNTER: { // Explosive Shot - if (spell->SpellFamilyFlags & 0x8000000000000000LL) + if (spell->SpellFamilyFlags & UI64LIT(0x8000000000000000)) { if (!caster) return; @@ -6512,17 +6519,17 @@ void Aura::PeriodicDummyTick() case SPELLFAMILY_DEATHKNIGHT: { // Death and Decay - if (spell->SpellFamilyFlags & 0x0000000000000020LL) + if (spell->SpellFamilyFlags & UI64LIT(0x0000000000000020)) { if (caster) caster->CastCustomSpell(m_target, 52212, &m_modifier.m_amount, NULL, NULL, true, 0, this); return; } // Raise Dead -// if (spell->SpellFamilyFlags & 0x0000000000001000LL) +// if (spell->SpellFamilyFlags & UI64LIT(0x0000000000001000)) // return; // Chains of Ice - if (spell->SpellFamilyFlags & 0x0000400000000000LL) + if (spell->SpellFamilyFlags & UI64LIT(0x0000400000000000)) { // Get 0 effect aura Aura *slow = m_target->GetAura(GetId(), 0); @@ -6537,10 +6544,10 @@ void Aura::PeriodicDummyTick() return; } // Summon Gargoyle -// if (spell->SpellFamilyFlags & 0x0000008000000000LL) +// if (spell->SpellFamilyFlags & UI64LIT(0x0000008000000000)) // return; // Death Rune Mastery -// if (spell->SpellFamilyFlags & 0x0000000000004000LL) +// if (spell->SpellFamilyFlags & UI64LIT(0x0000000000004000)) // return; // Bladed Armor if (spell->SpellIconID == 2653) @@ -6593,7 +6600,7 @@ void Aura::HandleManaShield(bool apply, bool Real) switch(m_spellProto->SpellFamilyName) { case SPELLFAMILY_MAGE: - if(m_spellProto->SpellFamilyFlags & 0x8000) + if(m_spellProto->SpellFamilyFlags & UI64LIT(0x8000)) { // Mana Shield // +50% from +spd bonus diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index e380ed32b..69ef4975a 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -311,7 +311,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) case SPELLFAMILY_GENERIC: { //Gore - if(m_spellInfo->SpellIconID == 2269 ) + if (m_spellInfo->SpellIconID == 2269 ) { damage+= rand()%2 ? damage : 0; } @@ -362,7 +362,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) case SPELLFAMILY_MAGE: { // Arcane Blast - if(m_spellInfo->SpellFamilyFlags & 0x20000000LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x20000000)) { m_caster->CastSpell(m_caster, 36032, true); } @@ -371,27 +371,27 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) case SPELLFAMILY_WARRIOR: { // Bloodthirst - if(m_spellInfo->SpellFamilyFlags & 0x40000000000LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x40000000000)) { damage = uint32(damage * (m_caster->GetTotalAttackPowerValue(BASE_ATTACK)) / 100); } // Shield Slam - else if(m_spellInfo->SpellFamilyFlags & 0x0000020000000000LL && m_spellInfo->Category==1209) + else if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000020000000000)) && m_spellInfo->Category==1209) damage += int32(m_caster->GetShieldBlockValue()); // Victory Rush - else if(m_spellInfo->SpellFamilyFlags & 0x10000000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x10000000000)) { damage = uint32(damage * m_caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); m_caster->ModifyAuraState(AURA_STATE_WARRIOR_VICTORY_RUSH, false); } // Revenge ${$m1+$AP*0.207} to ${$M1+$AP*0.207} - else if(m_spellInfo->SpellFamilyFlags & 0x0000000000000400LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000400)) damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.207f); // Heroic Throw ${$m1+$AP*.50} - else if(m_spellInfo->SpellFamilyFlags & 0x0000000100000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000100000000)) damage+= uint32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.5f); // Shockwave ${$m3/100*$AP} - else if(m_spellInfo->SpellFamilyFlags & 0x0000800000000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000000)) { int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[2], unitTarget); if (pct > 0) @@ -403,7 +403,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) case SPELLFAMILY_WARLOCK: { // Incinerate Rank 1 & 2 - if((m_spellInfo->SpellFamilyFlags & 0x00004000000000LL) && m_spellInfo->SpellIconID==2128) + if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x00004000000000)) && m_spellInfo->SpellIconID==2128) { // Incinerate does more dmg (dmg*0.25) if the target is Immolated. if(unitTarget->HasAuraState(AURA_STATE_IMMOLATE)) @@ -414,14 +414,14 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) case SPELLFAMILY_PRIEST: { // Shadow Word: Death - deals damage equal to damage done to caster - if (m_spellInfo->SpellFamilyFlags & 0x0000000200000000LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000200000000)) m_caster->CastCustomSpell(m_caster, 32409, &damage, 0, 0, true); break; } case SPELLFAMILY_DRUID: { // Ferocious Bite - if(m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & 0x000800000) && m_spellInfo->SpellVisual[0]==6587) + if (m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x000800000)) && m_spellInfo->SpellVisual[0]==6587) { // converts each extra point of energy into ($f1+$AP/410) additional damage float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); @@ -431,22 +431,22 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) m_caster->SetPower(POWER_ENERGY,0); } // Rake - else if(m_spellInfo->SpellFamilyFlags & 0x0000000000001000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000001000)) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); } // Swipe - else if(m_spellInfo->SpellFamilyFlags & 0x0010000000000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0010000000000000)) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.08f); } //Mangle Bonus for the initial damage of Lacerate and Rake - if((m_spellInfo->SpellFamilyFlags==0x0000000000001000LL && m_spellInfo->SpellIconID==494) || - (m_spellInfo->SpellFamilyFlags==0x0000010000000000LL && m_spellInfo->SpellIconID==2246)) + if ((m_spellInfo->SpellFamilyFlags==UI64LIT(0x0000000000001000) && m_spellInfo->SpellIconID==494) || + (m_spellInfo->SpellFamilyFlags==UI64LIT(0x0000010000000000) && m_spellInfo->SpellIconID==2246)) { Unit::AuraList const& mDummyAuras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) - if((*i)->GetSpellProto()->SpellFamilyFlags & 0x0000044000000000LL && (*i)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_DRUID) + if(((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000044000000000)) && (*i)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_DRUID) { damage = int32(damage*(100.0f+(*i)->GetModifier()->m_amount)/100.0f); break; @@ -457,7 +457,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) case SPELLFAMILY_ROGUE: { // Envenom - if(m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & 0x800000000LL)) + if (m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x800000000))) { // consume from stack dozes not more that have combo-points if(uint32 combo = ((Player*)m_caster)->GetComboPoints()) @@ -467,7 +467,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_ROGUE && - (*itr)->GetSpellProto()->SpellFamilyFlags & 0x10000 && + ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x10000)) && (*itr)->GetCasterGUID()==m_caster->GetGUID() ) { poison = *itr; @@ -491,7 +491,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) } } // Eviscerate - else if((m_spellInfo->SpellFamilyFlags & 0x00020000LL) && m_caster->GetTypeId()==TYPEID_PLAYER) + else if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x00020000)) && m_caster->GetTypeId()==TYPEID_PLAYER) { if(uint32 combo = ((Player*)m_caster)->GetComboPoints()) { @@ -504,17 +504,17 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) } } // Gouge - else if(m_spellInfo->SpellFamilyFlags & 0x0000000000000008LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000008)) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.21f); } // Instant Poison - else if(m_spellInfo->SpellFamilyFlags & 0x0000000000002000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000002000)) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.10f); } // Wound Poison - else if(m_spellInfo->SpellFamilyFlags & 0x0000000010000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000010000000)) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.04f); } @@ -523,28 +523,28 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) case SPELLFAMILY_HUNTER: { // Mongoose Bite - if((m_spellInfo->SpellFamilyFlags & 0x000000002) && m_spellInfo->SpellVisual[0]==342) + if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x000000002)) && m_spellInfo->SpellVisual[0]==342) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f); } // Counterattack - else if(m_spellInfo->SpellFamilyFlags & 0x0008000000000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0008000000000000)) { damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f); } // Arcane Shot - else if((m_spellInfo->SpellFamilyFlags & 0x00000800) && m_spellInfo->maxLevel > 0) + else if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x00000800)) && m_spellInfo->maxLevel > 0) { damage += int32(m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.15f); } // Steady Shot - else if(m_spellInfo->SpellFamilyFlags & 0x100000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x100000000)) { int32 base = irand((int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MINDAMAGE),(int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MAXDAMAGE)); damage += int32(float(base)/m_caster->GetAttackTime(RANGED_ATTACK)*2800 + m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.2f); } // Explosive Trap Effect - else if(m_spellInfo->SpellFamilyFlags & 0x00000004) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x00000004)) { damage += int32(m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.1f); } @@ -553,7 +553,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) case SPELLFAMILY_PALADIN: { // Judgement of Vengeance ${1+0.22*$SPH+0.14*$AP} + 10% for each application of Holy Vengeance on the target - if((m_spellInfo->SpellFamilyFlags & 0x800000000LL) && m_spellInfo->SpellIconID==2292) + if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x800000000)) && m_spellInfo->SpellIconID==2292) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + @@ -573,7 +573,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) damage += damage * stacks * 10 /100; } // Avenger's Shield ($m1+0.07*$SPH+0.07*$AP) - ranged sdb for future - else if(m_spellInfo->SpellFamilyFlags & 0x0000000000004000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + @@ -581,7 +581,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) damage += int32(ap * 0.07f) + int32(holy * 7 / 100); } // Hammer of Wrath ($m1+0.15*$SPH+0.15*$AP) - ranged type sdb future fix - else if(m_spellInfo->SpellFamilyFlags & 0x0000008000000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000008000000000)) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + @@ -589,7 +589,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) damage += int32(ap * 0.15f) + int32(holy * 15 / 100); } // Hammer of the Righteous - else if(m_spellInfo->SpellFamilyFlags&0x0004000000000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0004000000000000)) { // Add main hand dps * effect[2] amount float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2; @@ -597,7 +597,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) damage += count * int32(average * IN_MILISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); } // Shield of Righteousness - else if(m_spellInfo->SpellFamilyFlags&0x0010000000000000LL) + else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0010000000000000)) { damage+=int32(m_caster->GetShieldBlockValue()); } @@ -1223,14 +1223,14 @@ void Spell::EffectDummy(uint32 i) break; case SPELLFAMILY_WARRIOR: // Charge - if(m_spellInfo->SpellFamilyFlags & 0x1 && m_spellInfo->SpellVisual[0] == 867) + if((m_spellInfo->SpellFamilyFlags & UI64LIT(0x1)) && m_spellInfo->SpellVisual[0] == 867) { int32 chargeBasePoints0 = damage; m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true); return; } // Execute - if(m_spellInfo->SpellFamilyFlags & 0x20000000) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x20000000)) { if(!unitTarget) return; @@ -1247,7 +1247,7 @@ void Spell::EffectDummy(uint32 i) return; } // Slam - if(m_spellInfo->SpellFamilyFlags & 0x0000000000200000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000200000)) { if(!unitTarget) return; @@ -1256,7 +1256,7 @@ void Spell::EffectDummy(uint32 i) return; } // Concussion Blow - if(m_spellInfo->SpellFamilyFlags & 0x0000000004000000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) { m_damage+= uint32(damage * m_caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); return; @@ -1288,7 +1288,7 @@ void Spell::EffectDummy(uint32 i) break; case SPELLFAMILY_WARLOCK: // Life Tap - if (m_spellInfo->SpellFamilyFlags & 0x0000000000040000LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000040000)) { // In 303 exist spirit depend uint32 spirit = uint32(m_caster->GetStat(STAT_SPIRIT)); @@ -1344,7 +1344,7 @@ void Spell::EffectDummy(uint32 i) break; case SPELLFAMILY_PRIEST: // Penance - if (m_spellInfo->SpellFamilyFlags & 0x0080000000000000LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0080000000000000)) { if (!unitTarget) return; @@ -1370,7 +1370,7 @@ void Spell::EffectDummy(uint32 i) break; case SPELLFAMILY_DRUID: // Starfall - if (m_spellInfo->SpellFamilyFlags2 & 0x00000100LL) + if (m_spellInfo->SpellFamilyFlags2 & UI64LIT(0x00000100)) { //Shapeshifting into an animal form or mounting cancels the effect. if(m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted()) @@ -1446,7 +1446,7 @@ void Spell::EffectDummy(uint32 i) uint32 classspell = itr->first; SpellEntry const *spellInfo = sSpellStore.LookupEntry(classspell); - if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (spellInfo->SpellFamilyFlags & 0x0000024000000860LL)) + if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (spellInfo->SpellFamilyFlags & UI64LIT(0x0000024000000860))) ((Player*)m_caster)->RemoveSpellCooldown(classspell,true); } return; @@ -1460,7 +1460,7 @@ void Spell::EffectDummy(uint32 i) break; case SPELLFAMILY_HUNTER: // Steady Shot - if(m_spellInfo->SpellFamilyFlags & 0x100000000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x100000000)) { if( !unitTarget || !unitTarget->isAlive()) return; @@ -1565,8 +1565,8 @@ void Spell::EffectDummy(uint32 i) mod->value = -50; mod->type = SPELLMOD_PCT; mod->spellId = m_spellInfo->Id; - mod->mask = 0x0000020000000000LL; - mod->mask2= 0LL; + mod->mask = UI64LIT(0x0000020000000000); + mod->mask2= UI64LIT(0x0); ((Player*)m_caster)->AddSpellMod(mod, true); m_caster->CastSpell(unitTarget, spell_proto, true, NULL); @@ -1696,19 +1696,19 @@ void Spell::EffectDummy(uint32 i) return; } // Cleansing Totem - if(m_spellInfo->SpellFamilyFlags & 0x0000000004000000LL && m_spellInfo->SpellIconID==1673) + if((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) && m_spellInfo->SpellIconID==1673) { m_caster->CastSpell(unitTarget, 52025, true); return; } // Healing Stream Totem - if(m_spellInfo->SpellFamilyFlags & 0x0000000000002000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000002000)) { m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); return; } // Mana Spring Totem - if(m_spellInfo->SpellFamilyFlags & 0x0000000000004000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { if(unitTarget->getPowerType()!=POWER_MANA) return; @@ -1742,7 +1742,7 @@ void Spell::EffectDummy(uint32 i) for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr) { if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_SHAMAN && - (*itr)->GetSpellProto()->SpellFamilyFlags & 0x0000000000200000LL && + ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000200000)) && (*itr)->GetCastItemGUID() == item->GetGUID()) { m_damage += m_damage * damage / 100; @@ -1755,7 +1755,7 @@ void Spell::EffectDummy(uint32 i) break; case SPELLFAMILY_DEATHKNIGHT: // Death Coil - if(m_spellInfo->SpellFamilyFlags & 0x002000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x002000)) { if(m_caster->IsFriendlyTo(unitTarget)) { @@ -2306,7 +2306,7 @@ void Spell::EffectApplyAura(uint32 i) return; // Prayer of Mending (jump animation), we need formal caster instead original for correct animation - if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags & 0x00002000000000LL)) + if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x00002000000000))) m_caster->CastSpell(unitTarget, 41637, true, NULL, Aur, m_originalCasterGUID); } @@ -2472,7 +2472,7 @@ void Spell::EffectHeal( uint32 /*i*/ ) if(!targetAura) { - sLog.outError("Target(GUID:" I64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); + sLog.outError("Target (GUID: %u TypeId: %u) has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUIDLow(), unitTarget->GetTypeId()); return; } int idx = 0; @@ -3296,9 +3296,10 @@ void Spell::EffectSummon(uint32 i) map->Add((Creature*)spawnCreature); + m_caster->SetPet(spawnCreature); + if(m_caster->GetTypeId() == TYPEID_PLAYER) { - m_caster->SetPet(spawnCreature); spawnCreature->GetCharmInfo()->SetReactState( REACT_DEFENSIVE ); spawnCreature->SavePetToDB(PET_SAVE_AS_CURRENT); ((Player*)m_caster)->PetSpellInitialize(); @@ -4325,7 +4326,7 @@ void Spell::EffectWeaponDmg(uint32 i) case SPELLFAMILY_WARRIOR: { // Whirlwind, single only spell with 2 weapon white damage apply if have - if(m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & 0x00000400000000LL)) + if(m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x00000400000000))) { if(((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK,true)) spell_bonus += m_caster->CalculateDamage (OFF_ATTACK, normalized); @@ -4340,7 +4341,7 @@ void Spell::EffectWeaponDmg(uint32 i) { SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); if( spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && - spellInfo->SpellFamilyFlags & 0x0000000000004000LL && + (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) && (*itr).second->GetCasterGUID() == m_caster->GetGUID()) { (*itr).second->RefreshAura(); @@ -4355,7 +4356,7 @@ void Spell::EffectWeaponDmg(uint32 i) case SPELLFAMILY_ROGUE: { // Mutilate (for each hand) - if(m_spellInfo->SpellFamilyFlags & 0x600000000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x600000000)) { bool found = false; // fast check @@ -4383,7 +4384,7 @@ void Spell::EffectWeaponDmg(uint32 i) case SPELLFAMILY_PALADIN: { // Seal of Command - receive benefit from Spell Damage and Healing - if(m_spellInfo->SpellFamilyFlags & 0x00000002000000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x00000002000000)) { spellBonusNeedWeaponDamagePercentMod = true;// apply weaponDamagePercentMod to spell_bonus (and then to all bonus, fixes and weapon already have applied) spell_bonus += int32(0.23f*m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo))); @@ -4395,7 +4396,7 @@ void Spell::EffectWeaponDmg(uint32 i) { // Skyshatter Harness item set bonus // Stormstrike - if(m_spellInfo->SpellFamilyFlags & 0x001000000000LL) + if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x001000000000)) { Unit::AuraList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for(Unit::AuraList::const_iterator citr = m_OverrideClassScript.begin(); citr != m_OverrideClassScript.end(); ++citr) @@ -4472,14 +4473,14 @@ void Spell::EffectWeaponDmg(uint32 i) m_damage+= eff_damage; // Hemorrhage - if(m_spellInfo->SpellFamilyName==SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & 0x2000000)) + if (m_spellInfo->SpellFamilyName==SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x2000000))) { if(m_caster->GetTypeId()==TYPEID_PLAYER) ((Player*)m_caster)->AddComboPoints(unitTarget, 1); } // Mangle (Cat): CP - if(m_spellInfo->SpellFamilyName==SPELLFAMILY_DRUID && (m_spellInfo->SpellFamilyFlags==0x0000040000000000LL)) + if (m_spellInfo->SpellFamilyName==SPELLFAMILY_DRUID && (m_spellInfo->SpellFamilyFlags==UI64LIT(0x0000040000000000))) { if(m_caster->GetTypeId()==TYPEID_PLAYER) ((Player*)m_caster)->AddComboPoints(unitTarget, 1); @@ -5032,7 +5033,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) { SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); if(spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && - spellInfo->SpellFamilyFlags & 0x0000000000000002LL && + (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000002)) && (*itr).second->GetCasterGUID()==m_caster->GetGUID()) (*itr).second->RefreshAura(); } @@ -5055,8 +5056,8 @@ void Spell::EffectScriptEffect(uint32 effIndex) for(Unit::AuraMap::iterator itr = auras.begin(); itr != auras.end(); ++itr) { SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); - if( spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && - spellInfo->SpellFamilyFlags & 0x0000000000008000LL && + if (spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && + (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000008000)) && (*itr).second->GetCasterGUID() == m_caster->GetGUID()) { (*itr).second->RefreshAura(); @@ -5087,29 +5088,29 @@ void Spell::EffectScriptEffect(uint32 effIndex) continue; // Search only Serpent Sting, Viper Sting, Scorpid Sting auras uint64 familyFlag = aura->GetSpellProto()->SpellFamilyFlags; - if (!(familyFlag & 0x000000800000C000LL)) + if (!(familyFlag & UI64LIT(0x000000800000C000))) continue; // Refresh aura duration aura->RefreshAura(); // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting. - if (familyFlag & 0x0000000000004000LL && aura->GetEffIndex() == 0) + if ((familyFlag & UI64LIT(0x0000000000004000)) && aura->GetEffIndex() == 0) { spellId = 53353; // 53353 Chimera Shot - Serpent basePoint = aura->GetModifier()->m_amount * 5 * 40 / 100; } // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. - if (familyFlag & 0x0000008000000000LL && aura->GetEffIndex() == 0) + if ((familyFlag & UI64LIT(0x0000008000000000)) && aura->GetEffIndex() == 0) { spellId = 53358; // 53358 Chimera Shot - Viper basePoint = aura->GetModifier()->m_amount * 4 * 60 / 100; } // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute. - if (familyFlag & 0x0000000000008000LL) + if (familyFlag & UI64LIT(0x0000000000008000)) spellId = 53359; // 53359 Chimera Shot - Scorpid // ?? nothing say in spell desc (possibly need addition check) - //if (familyFlag & 0x0000010000000000LL || // dot - // familyFlag & 0x0000100000000000LL) // stun + //if ((familyFlag & UI64LIT(0x0000010000000000)) || // dot + // (familyFlag & UI64LIT(0x0000100000000000))) // stun //{ // spellId = 53366; // 53366 Chimera Shot - Wyvern //} @@ -5126,7 +5127,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case SPELLFAMILY_PALADIN: { // Judgement - if (m_spellInfo->SpellFamilyFlags & 0x0000000000800000LL) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000800000)) { if(!unitTarget || !unitTarget->isAlive()) return; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 8626f133d..f06073ee6 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -138,17 +138,17 @@ SpellSpecific GetSpellSpecific(uint32 spellId) case SPELLFAMILY_MAGE: { // family flags 18(Molten), 25(Frost/Ice), 28(Mage) - if (spellInfo->SpellFamilyFlags & 0x12040000) + if (spellInfo->SpellFamilyFlags & UI64LIT(0x12040000)) return SPELL_MAGE_ARMOR; - if ((spellInfo->SpellFamilyFlags & 0x1000000) && spellInfo->EffectApplyAuraName[0]==SPELL_AURA_MOD_CONFUSE) + if ((spellInfo->SpellFamilyFlags & UI64LIT(0x1000000)) && spellInfo->EffectApplyAuraName[0]==SPELL_AURA_MOD_CONFUSE) return SPELL_MAGE_POLYMORPH; break; } case SPELLFAMILY_WARRIOR: { - if (spellInfo->SpellFamilyFlags & 0x00008000010000LL) + if (spellInfo->SpellFamilyFlags & UI64LIT(0x00008000010000)) return SPELL_POSITIVE_SHOUT; break; @@ -160,7 +160,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) return SPELL_CURSE; // Warlock (Demon Armor | Demon Skin | Fel Armor) - if (spellInfo->SpellFamilyFlags & 0x2000002000000000LL || spellInfo->SpellFamilyFlags2 & 0x00000010) + if (spellInfo->SpellFamilyFlags & UI64LIT(0x2000002000000000) || spellInfo->SpellFamilyFlags2 & 0x00000010) return SPELL_WARLOCK_ARMOR; break; @@ -172,7 +172,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) return SPELL_STING; // only hunter aspects have this (but not all aspects in hunter family) - if( spellInfo->SpellFamilyFlags & 0x0044000000380000LL || spellInfo->SpellFamilyFlags2 & 0x00003010) + if( spellInfo->SpellFamilyFlags & UI64LIT(0x0044000000380000) || spellInfo->SpellFamilyFlags2 & 0x00003010) return SPELL_ASPECT; if( spellInfo->SpellFamilyFlags2 & 0x00000002 ) @@ -185,10 +185,10 @@ SpellSpecific GetSpellSpecific(uint32 spellId) if (IsSealSpell(spellInfo)) return SPELL_SEAL; - if (spellInfo->SpellFamilyFlags & 0x0000000011010002LL) + if (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000011010002)) return SPELL_BLESSING; - if ((spellInfo->SpellFamilyFlags & 0x00000820180400LL) && (spellInfo->AttributesEx3 & 0x200)) + if ((spellInfo->SpellFamilyFlags & UI64LIT(0x00000820180400)) && (spellInfo->AttributesEx3 & 0x200)) return SPELL_JUDGEMENT; for (int i = 0; i < 3; ++i) @@ -339,11 +339,13 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) case SPELL_AURA_MOD_STAT: case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative) case SPELL_AURA_MOD_HEALING_DONE: - { if(spellproto->CalculateSimpleValue(effIndex) < 0) return false; break; - } + case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: + if(spellproto->CalculateSimpleValue(effIndex) > 0) + return true; // some expected possitive spells have SPELL_ATTR_EX_NEGATIVE + break; case SPELL_AURA_ADD_TARGET_TRIGGER: return true; case SPELL_AURA_PERIODIC_TRIGGER_SPELL: @@ -1189,7 +1191,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Improved Hamstring -> Hamstring (multi-family check) - if( (spellInfo_2->SpellFamilyFlags & 2) && spellInfo_1->Id == 23694 ) + if( (spellInfo_2->SpellFamilyFlags & UI64LIT(0x2)) && spellInfo_1->Id == 23694 ) return false; break; @@ -1221,7 +1223,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Improved Wing Clip -> Wing Clip (multi-family check) - if( (spellInfo_2->SpellFamilyFlags & 0x40) && spellInfo_1->Id == 19229 ) + if( (spellInfo_2->SpellFamilyFlags & UI64LIT(0x40)) && spellInfo_1->Id == 19229 ) return false; break; } @@ -1246,13 +1248,13 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if( spellInfo_2->SpellFamilyName == SPELLFAMILY_MAGE ) { // Blizzard & Chilled (and some other stacked with blizzard spells - if( (spellInfo_1->SpellFamilyFlags & 0x80) && (spellInfo_2->SpellFamilyFlags & 0x100000) || - (spellInfo_2->SpellFamilyFlags & 0x80) && (spellInfo_1->SpellFamilyFlags & 0x100000) ) + if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x100000)) || + (spellInfo_2->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x100000)) ) return false; // Blink & Improved Blink - if( (spellInfo_1->SpellFamilyFlags & 0x0000000000010000LL) && (spellInfo_2->SpellVisual[0] == 72 && spellInfo_2->SpellIconID == 1499) || - (spellInfo_2->SpellFamilyFlags & 0x0000000000010000LL) && (spellInfo_1->SpellVisual[0] == 72 && spellInfo_1->SpellIconID == 1499) ) + if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_2->SpellVisual[0] == 72 && spellInfo_2->SpellIconID == 1499) || + (spellInfo_2->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_1->SpellVisual[0] == 72 && spellInfo_1->SpellIconID == 1499) ) return false; } // Detect Invisibility and Mana Shield (multi-family check) @@ -1296,8 +1298,8 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if( spellInfo_2->SpellFamilyName == SPELLFAMILY_WARRIOR ) { // Rend and Deep Wound - if( (spellInfo_1->SpellFamilyFlags & 0x20) && (spellInfo_2->SpellFamilyFlags & 0x1000000000LL) || - (spellInfo_2->SpellFamilyFlags & 0x20) && (spellInfo_1->SpellFamilyFlags & 0x1000000000LL) ) + if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x1000000000)) || + (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x1000000000)) ) return false; // Battle Shout and Rampage @@ -1307,7 +1309,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons } // Hamstring -> Improved Hamstring (multi-family check) - if( (spellInfo_1->SpellFamilyFlags & 2) && spellInfo_2->Id == 23694 ) + if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x2)) && spellInfo_2->Id == 23694 ) return false; // Defensive Stance and Scroll of Protection (multi-family check) @@ -1323,17 +1325,17 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if( spellInfo_2->SpellFamilyName == SPELLFAMILY_PRIEST ) { //Devouring Plague and Shadow Vulnerability - if( (spellInfo_1->SpellFamilyFlags & 0x2000000) && (spellInfo_2->SpellFamilyFlags & 0x800000000LL) || - (spellInfo_2->SpellFamilyFlags & 0x2000000) && (spellInfo_1->SpellFamilyFlags & 0x800000000LL) ) + if ((spellInfo_1->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x800000000)) || + (spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x800000000))) return false; //StarShards and Shadow Word: Pain - if( (spellInfo_1->SpellFamilyFlags & 0x200000) && (spellInfo_2->SpellFamilyFlags & 0x8000) || - (spellInfo_2->SpellFamilyFlags & 0x200000) && (spellInfo_1->SpellFamilyFlags & 0x8000) ) + if ((spellInfo_1->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x8000)) || + (spellInfo_2->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000))) return false; // Dispersion - if( (spellInfo_1->Id == 47585 && spellInfo_2->Id == 60069) || - (spellInfo_2->Id == 47585 && spellInfo_1->Id == 60069) ) + if ((spellInfo_1->Id == 47585 && spellInfo_2->Id == 60069) || + (spellInfo_2->Id == 47585 && spellInfo_1->Id == 60069)) return false; } break; @@ -1341,8 +1343,8 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if( spellInfo_2->SpellFamilyName == SPELLFAMILY_DRUID ) { //Omen of Clarity and Blood Frenzy - if( (spellInfo_1->SpellFamilyFlags == 0x0 && spellInfo_1->SpellIconID == 108) && (spellInfo_2->SpellFamilyFlags & 0x20000000000000LL) || - (spellInfo_2->SpellFamilyFlags == 0x0 && spellInfo_2->SpellIconID == 108) && (spellInfo_1->SpellFamilyFlags & 0x20000000000000LL) ) + if( (spellInfo_1->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_1->SpellIconID == 108) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20000000000000)) || + (spellInfo_2->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_2->SpellIconID == 108) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000000)) ) return false; // Tree of Life (Shapeshift) and 34123 Tree of Life (Passive) @@ -1396,13 +1398,13 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if( spellInfo_2->SpellFamilyName == SPELLFAMILY_HUNTER ) { // Rapid Fire & Quick Shots - if( (spellInfo_1->SpellFamilyFlags & 0x20) && (spellInfo_2->SpellFamilyFlags & 0x20000000000LL) || - (spellInfo_2->SpellFamilyFlags & 0x20) && (spellInfo_1->SpellFamilyFlags & 0x20000000000LL) ) + if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20000000000)) || + (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000)) ) return false; // Serpent Sting & (Immolation/Explosive Trap Effect) - if( (spellInfo_1->SpellFamilyFlags & 0x4) && (spellInfo_2->SpellFamilyFlags & 0x00000004000LL) || - (spellInfo_2->SpellFamilyFlags & 0x4) && (spellInfo_1->SpellFamilyFlags & 0x00000004000LL) ) + if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x00000004000)) || + (spellInfo_2->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x00000004000)) ) return false; // Bestial Wrath @@ -1411,7 +1413,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons } // Wing Clip -> Improved Wing Clip (multi-family check) - if( (spellInfo_1->SpellFamilyFlags & 0x40) && spellInfo_2->Id == 19229 ) + if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x40)) && spellInfo_2->Id == 19229 ) return false; // Concussive Shot and Imp. Concussive Shot (multi-family check) @@ -2710,34 +2712,34 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto case SPELLFAMILY_ROGUE: { // Kidney Shot - if (spellproto->SpellFamilyFlags & 0x00000200000LL) + if (spellproto->SpellFamilyFlags & UI64LIT(0x00000200000)) return DIMINISHING_KIDNEYSHOT; // Blind - else if (spellproto->SpellFamilyFlags & 0x00001000000LL) + else if (spellproto->SpellFamilyFlags & UI64LIT(0x00001000000)) return DIMINISHING_BLIND_CYCLONE; break; } case SPELLFAMILY_WARLOCK: { // Fear - if (spellproto->SpellFamilyFlags & 0x40840000000LL) + if (spellproto->SpellFamilyFlags & UI64LIT(0x40840000000)) return DIMINISHING_WARLOCK_FEAR; // Curses/etc - else if (spellproto->SpellFamilyFlags & 0x00080000000LL) + else if (spellproto->SpellFamilyFlags & UI64LIT(0x00080000000)) return DIMINISHING_LIMITONLY; break; } case SPELLFAMILY_DRUID: { // Cyclone - if (spellproto->SpellFamilyFlags & 0x02000000000LL) + if (spellproto->SpellFamilyFlags & UI64LIT(0x02000000000)) return DIMINISHING_BLIND_CYCLONE; break; } case SPELLFAMILY_WARRIOR: { // Hamstring - limit duration to 10s in PvP - if (spellproto->SpellFamilyFlags & 0x00000000002LL) + if (spellproto->SpellFamilyFlags & UI64LIT(0x00000000002)) return DIMINISHING_LIMITONLY; break; } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 59915e800..a6d238e0f 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -67,15 +67,15 @@ enum SpellFamilyNames }; //Some SpellFamilyFlags -#define SPELLFAMILYFLAG_ROGUE_VANISH 0x000000800LL -#define SPELLFAMILYFLAG_ROGUE_STEALTH 0x000400000LL -#define SPELLFAMILYFLAG_ROGUE_BACKSTAB 0x000800004LL -#define SPELLFAMILYFLAG_ROGUE_SAP 0x000000080LL -#define SPELLFAMILYFLAG_ROGUE_FEINT 0x008000000LL -#define SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT 0x000200000LL -#define SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE 0x9003E0000LL +#define SPELLFAMILYFLAG_ROGUE_VANISH UI64LIT(0x000000800) +#define SPELLFAMILYFLAG_ROGUE_STEALTH UI64LIT(0x000400000) +#define SPELLFAMILYFLAG_ROGUE_BACKSTAB UI64LIT(0x000800004) +#define SPELLFAMILYFLAG_ROGUE_SAP UI64LIT(0x000000080) +#define SPELLFAMILYFLAG_ROGUE_FEINT UI64LIT(0x008000000) +#define SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT UI64LIT(0x000200000) +#define SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE UI64LIT(0x9003E0000) -#define SPELLFAMILYFLAG_PALADIN_SEALS 0x26000C000A000000LL +#define SPELLFAMILYFLAG_PALADIN_SEALS UI64LIT(0x26000C000A000000) // Spell clasification enum SpellSpecific { @@ -130,7 +130,7 @@ inline bool IsSealSpell(SpellEntry const *spellInfo) inline bool IsElementalShield(SpellEntry const *spellInfo) { // family flags 10 (Lightning), 42 (Earth), 37 (Water), proc shield from T2 8 pieces bonus - return (spellInfo->SpellFamilyFlags & 0x42000000400LL) || spellInfo->Id == 23552; + return (spellInfo->SpellFamilyFlags & UI64LIT(0x42000000400)) || spellInfo->Id == 23552; } inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 89cb0fadc..f0aec5ae2 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -2323,7 +2323,7 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const return (100.0f - LvlPenalty) * LvlFactor / 100.0f; } -void Unit::SendAttackStart(Unit* pVictim) +void Unit::SendMeleeAttackStart(Unit* pVictim) { WorldPacket data( SMSG_ATTACKSTART, 8 + 8 ); data << uint64(GetGUID()); @@ -2333,7 +2333,7 @@ void Unit::SendAttackStart(Unit* pVictim) DEBUG_LOG( "WORLD: Sent SMSG_ATTACKSTART" ); } -void Unit::SendAttackStop(Unit* victim) +void Unit::SendMeleeAttackStop(Unit* victim) { if(!victim) return; @@ -3743,7 +3743,7 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit { // Custom dispel case // Unstable Affliction - if (aur->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (aur->GetSpellProto()->SpellFamilyFlags & 0x010000000000LL)) + if (aur->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (aur->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x010000000000))) { int32 damage = aur->GetModifier()->m_amount*9; uint64 caster_guid = aur->GetCasterGUID(); @@ -4553,7 +4553,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu { if(SpellEntry const* iterSpellProto = (*iter)->GetSpellProto()) { - if(iterSpellProto->SpellFamilyName==SPELLFAMILY_MAGE && (iterSpellProto->SpellFamilyFlags & 0x10000000)) + if(iterSpellProto->SpellFamilyName==SPELLFAMILY_MAGE && (iterSpellProto->SpellFamilyFlags & UI64LIT(0x10000000))) { found=true; break; @@ -4949,7 +4949,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu break; } // Incanter's Regalia set (add trigger chance to Mana Shield) - if (dummySpell->SpellFamilyFlags & 0x0000000000008000LL) + if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000000000008000)) { if(GetTypeId() != TYPEID_PLAYER) return false; @@ -5001,7 +5001,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case SPELLFAMILY_WARRIOR: { // Retaliation - if(dummySpell->SpellFamilyFlags==0x0000000800000000LL) + if (dummySpell->SpellFamilyFlags == UI64LIT(0x0000000800000000)) { // check attack comes not from behind if (!HasInArc(M_PI, pVictim)) @@ -5045,7 +5045,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case SPELLFAMILY_WARLOCK: { // Seed of Corruption - if (dummySpell->SpellFamilyFlags & 0x0000001000000000LL) + if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000001000000000)) { Modifier* mod = triggeredByAura->GetModifier(); // if damage is more than need or target die from damage deal finish spell @@ -5067,7 +5067,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return true; } // Seed of Corruption (Mobs cast) - no die req - if (dummySpell->SpellFamilyFlags == 0x00LL && dummySpell->SpellIconID == 1932) + if (dummySpell->SpellFamilyFlags == UI64LIT(0x0) && dummySpell->SpellIconID == 1932) { Modifier* mod = triggeredByAura->GetModifier(); // if damage is more than need deal finish spell @@ -5148,7 +5148,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case SPELLFAMILY_PRIEST: { // Vampiric Touch - if( dummySpell->SpellFamilyFlags & 0x0000040000000000LL ) + if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000040000000000)) { if(!pVictim || !pVictim->isAlive()) return false; @@ -5190,10 +5190,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 40438: { // Shadow Word: Pain - if( procSpell->SpellFamilyFlags & 0x0000000000008000LL ) + if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000008000)) triggered_spell_id = 40441; // Renew - else if( procSpell->SpellFamilyFlags & 0x0000000000000010LL ) + else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000010)) triggered_spell_id = 40440; else return false; @@ -5275,19 +5275,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu float chance; // Starfire - if( procSpell->SpellFamilyFlags & 0x0000000000000004LL ) + if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000004)) { triggered_spell_id = 40445; chance = 25.0f; } // Rejuvenation - else if( procSpell->SpellFamilyFlags & 0x0000000000000010LL ) + else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000010)) { triggered_spell_id = 40446; chance = 25.0f; } // Mangle (cat/bear) - else if( procSpell->SpellFamilyFlags & 0x0000044000000000LL ) + else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000044000000000)) { triggered_spell_id = 40452; chance = 40.0f; @@ -5318,7 +5318,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (effIndex!=0) return true; // Wrath crit - if (procSpell->SpellFamilyFlags & 0x0000000000000001LL) + if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000001)) { if (!roll_chance_i(60)) return false; @@ -5327,7 +5327,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu break; } // Starfire crit - if (procSpell->SpellFamilyFlags & 0x0000000000000004LL) + if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000004)) { triggered_spell_id = 48517; target = this; @@ -5368,8 +5368,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu for(AuraList::const_iterator itr = sd.begin(); itr != sd.end(); ++itr) { SpellEntry const *spellProto = (*itr)->GetSpellProto(); - if( spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && - spellProto->SpellFamilyFlags & 0x0000000000040000LL) + if (spellProto->SpellFamilyName == SPELLFAMILY_ROGUE && + (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000040000))) { (*itr)->SetAuraMaxDuration(GetSpellMaxDuration(spellProto)); (*itr)->RefreshAura(); @@ -5404,7 +5404,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case SPELLFAMILY_HUNTER: { // Aspect of the Viper - if ( dummySpell->SpellFamilyFlags & 0x4000000000000LL ) + if (dummySpell->SpellFamilyFlags & UI64LIT(0x4000000000000)) { uint32 maxmana = GetMaxPower(POWER_MANA); basepoints0 = maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f; @@ -5414,7 +5414,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu break; } // Thrill of the Hunt - if ( dummySpell->SpellIconID == 2236 ) + if (dummySpell->SpellIconID == 2236) { if(!procSpell) return false; @@ -5450,7 +5450,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if ( dummySpell->SpellIconID == 3560 ) { // This effect only from Rapid Killing (mana regen) - if (!(procSpell->SpellFamilyFlags & 0x0100000000000000LL)) + if (!(procSpell->SpellFamilyFlags & UI64LIT(0x0100000000000000))) return false; triggered_spell_id = 56654; target = this; @@ -5461,7 +5461,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case SPELLFAMILY_PALADIN: { // Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage) - if (dummySpell->SpellFamilyFlags&0x000000008000000LL && effIndex==0) + if ((dummySpell->SpellFamilyFlags & UI64LIT(0x000000008000000)) && effIndex==0) { triggered_spell_id = 25742; float ap = GetTotalAttackPowerValue(BASE_ATTACK); @@ -5471,7 +5471,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu break; } // Sacred Shield - if (dummySpell->SpellFamilyFlags&0x0008000000000000LL) + if (dummySpell->SpellFamilyFlags & UI64LIT(0x0008000000000000)) { triggered_spell_id = 58597; target = this; @@ -5607,19 +5607,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal) case 40470: { - if( !procSpell ) + if (!procSpell) return false; float chance; // Flash of light/Holy light - if( procSpell->SpellFamilyFlags & 0x00000000C0000000LL) + if (procSpell->SpellFamilyFlags & UI64LIT(0x00000000C0000000)) { triggered_spell_id = 40471; chance = 15.0f; } // Judgement - else if( procSpell->SpellFamilyFlags & 0x0000000000800000LL ) + else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000800000)) { triggered_spell_id = 40472; chance = 50.0f; @@ -5779,17 +5779,17 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu return false; float chance; - if (procSpell->SpellFamilyFlags & 0x0000000000000001LL) + if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000001)) { triggered_spell_id = 40465; // Lightning Bolt chance = 15.0f; } - else if (procSpell->SpellFamilyFlags & 0x0000000000000080LL) + else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080)) { triggered_spell_id = 40465; // Lesser Healing Wave chance = 10.0f; } - else if (procSpell->SpellFamilyFlags & 0x0000001000000000LL) + else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000001000000000)) { triggered_spell_id = 40466; // Stormstrike chance = 50.0f; @@ -5835,7 +5835,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu break; } // Earth Shield - if(dummySpell->SpellFamilyFlags & 0x0000040000000000LL) + if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000040000000000)) { basepoints0 = triggerAmount; target = this; @@ -5846,14 +5846,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu if (dummySpell->SpellIconID == 2287) { // Lesser Healing Wave need aditional 60% roll - if (procSpell->SpellFamilyFlags & 0x0000000000000080LL && !roll_chance_i(60)) + if ((procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080)) && !roll_chance_i(60)) return false; // lookup water shield AuraList const& vs = GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL); for(AuraList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr) { - if( (*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && - (*itr)->GetSpellProto()->SpellFamilyFlags & 0x0000002000000000LL) + if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && + ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000002000000000))) { uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()]; CastSpell(this, spell, true, castItem, triggeredByAura); @@ -5914,12 +5914,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu mod->value = -100; mod->type = SPELLMOD_PCT; mod->spellId = dummySpell->Id; - mod->mask = 0x0000000000000003LL; - mod->mask2= 0LL; + mod->mask = UI64LIT(0x0000000000000003); + mod->mask2= UI64LIT(0x0); ((Player*)this)->AddSpellMod(mod, true); // Remove cooldown (Chain Lightning - have Category Recovery time) - if (procSpell->SpellFamilyFlags & 0x0000000000000002LL) + if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000002)) ((Player*)this)->RemoveSpellCooldown(spellId); CastSpell(pVictim, spellId, true, castItem, triggeredByAura); @@ -5938,8 +5938,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu AuraList const& vs = GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL); for(AuraList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr) { - if( (*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && - (*itr)->GetSpellProto()->SpellFamilyFlags & 0x0000000000000400LL) + if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && + ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000400))) { uint32 spell = 0; switch ((*itr)->GetId()) @@ -6006,7 +6006,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu break; } // Vendetta - if (dummySpell->SpellFamilyFlags & 0x0000000000010000LL) + if (dummySpell->SpellFamilyFlags & UI64LIT(0x0000000000010000)) { basepoints0 = triggerAmount * GetMaxHealth() / 100; triggered_spell_id = 50181; @@ -6269,10 +6269,10 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB uint32 tick = 1; // Default tick = 1 // Hellfire have 15 tick - if (procSpell->SpellFamilyFlags&0x0000000000000040LL) + if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000040)) tick = 15; // Rain of Fire have 4 tick - else if (procSpell->SpellFamilyFlags&0x0000000000000020LL) + else if (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000020)) tick = 4; else return false; @@ -6291,7 +6291,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB trigger_spell_id = 18093; } // Drain Soul - else if (auraSpellInfo->SpellFamilyFlags & 0x0000000000004000LL) + else if (auraSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { Unit::AuraList const& mAddFlatModifier = GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); for(Unit::AuraList::const_iterator i = mAddFlatModifier.begin(); i != mAddFlatModifier.end(); ++i) @@ -6420,7 +6420,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB // procspell is triggered spell but we need mana cost of original casted spell uint32 originalSpellId = procSpell->Id; // Holy Shock heal - if(procSpell->SpellFamilyFlags & 0x0001000000000000LL) + if (procSpell->SpellFamilyFlags & UI64LIT(0x0001000000000000)) { switch(procSpell->Id) { @@ -6488,7 +6488,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB case SPELLFAMILY_SHAMAN: { // Lightning Shield (overwrite non existing triggered spell call in spell.dbc - if(auraSpellInfo->SpellFamilyFlags & 0x0000000000000400) + if (auraSpellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000400)) { switch(auraSpellInfo->Id) { @@ -6667,7 +6667,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB case 53232: { // This effect only from Rapid Fire (ability cast) - if (!(procSpell->SpellFamilyFlags & 0x0000000000000020LL)) + if (!(procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000020))) return false; break; } @@ -6725,7 +6725,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB if(!procSpell) return false; // For trigger from Blizzard need exist Improved Blizzard - if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && procSpell->SpellFamilyFlags & 0x0000000000000080LL) + if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && (procSpell->SpellFamilyFlags & UI64LIT(0x0000000000000080))) { bool found = false; AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); @@ -7250,7 +7250,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) if( meleeAttack && !hasUnitState(UNIT_STAT_MELEE_ATTACKING) ) { addUnitState(UNIT_STAT_MELEE_ATTACKING); - SendAttackStart(victim); + SendMeleeAttackStart(victim); return true; } return false; @@ -7291,7 +7291,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) resetAttackTimer(OFF_ATTACK); if(meleeAttack) - SendAttackStart(victim); + SendMeleeAttackStart(victim); return true; } @@ -7320,7 +7320,7 @@ bool Unit::AttackStop(bool targetSwitch /*=false*/) ((Creature*)this)->SetNoSearchAssistance(false); } - SendAttackStop(victim); + SendMeleeAttackStop(victim); return true; } @@ -7511,7 +7511,7 @@ void Unit::SetPet(Pet* pet) SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0); // FIXME: hack, speed must be set only at follow - if(pet) + if(pet && GetTypeId()==TYPEID_PLAYER) for(int i = 0; i < MAX_MOVE_TYPE; ++i) pet->SetSpeed(UnitMoveType(i), m_speed_rate[i], true); } @@ -7695,7 +7695,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 for (AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr) { SpellEntry const* m_spell = itr->second->GetSpellProto(); - if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags & 0x0004071B8044C402LL)) + if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags & UI64LIT(0x0004071B8044C402))) continue; modPercent += stepPercent * itr->second->GetStackAmount(); if (modPercent >= maxPercent) @@ -7715,7 +7715,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 break; case 5481: // Starfire Bonus { - if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x0000000000200002LL)) + if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, UI64LIT(0x0000000000200002))) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; break; } @@ -7742,7 +7742,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } else // Tundra Stalker { - if (pVictim->GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_DEATHKNIGHT, 0x0400000000000000LL)) + if (pVictim->GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_DEATHKNIGHT, UI64LIT(0x0400000000000000))) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; break; } @@ -7750,14 +7750,14 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 } case 7293: // Rage of Rivendare { - if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0x0200000000000000LL)) + if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, UI64LIT(0x0200000000000000))) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; break; } // Twisted Faith case 7377: { - if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x0000000000008000LL, 0, GetGUID())) + if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, UI64LIT(0x0000000000008000), 0, GetGUID())) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; break; } @@ -7768,7 +7768,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3 case 7601: case 7602: { - if (pVictim->GetAura(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x0000000000000400LL)) + if (pVictim->GetAura(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, UI64LIT(0x0000000000000400))) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; break; } @@ -8044,7 +8044,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM { case SPELLFAMILY_PALADIN: // Sacred Shield - if (spellProto->SpellFamilyFlags & 0x0000000040000000LL) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000000040000000)) { Aura *aura = pVictim->GetDummyAura(58597); if (aura && aura->GetCasterGUID() == GetGUID()) @@ -8054,9 +8054,9 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM break; case SPELLFAMILY_SHAMAN: // Lava Burst - if (spellProto->SpellFamilyFlags & 0x0000100000000000LL) + if (spellProto->SpellFamilyFlags & UI64LIT(0x0000100000000000)) { - if (Aura *flameShock = pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x0000000010000000LL, 0, GetGUID())) + if (Aura *flameShock = pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, UI64LIT(0x0000000010000000), 0, GetGUID())) { // Consume shock aura if not have Glyph of Flame Shock if (!GetAura(55447, 0)) @@ -8143,8 +8143,6 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama break; } - crit_bonus = int32(crit_bonus * GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_BONUS)); - if(pVictim) { uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); @@ -8154,6 +8152,8 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama if(crit_bonus > 0) damage += crit_bonus; + damage = int32(damage * GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT)); + return damage; } @@ -8208,7 +8208,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint break; case 7798: // Glyph of Regrowth { - if (pVictim->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x0000000000000040LL)) + if (pVictim->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, UI64LIT(0x0000000000000040))) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; break; } @@ -8222,8 +8222,8 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint if (itr->second->GetCasterGUID()!=GetGUID()) continue; SpellEntry const* m_spell = itr->second->GetSpellProto(); - if ( m_spell->SpellFamilyName != SPELLFAMILY_DRUID || - !(m_spell->SpellFamilyFlags & 0x0000001000000050LL)) + if (m_spell->SpellFamilyName != SPELLFAMILY_DRUID || + !(m_spell->SpellFamilyFlags & UI64LIT(0x0000001000000050))) continue; modPercent += stepPercent * itr->second->GetStackAmount(); } @@ -8232,7 +8232,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint } case 7871: // Glyph of Lesser Healing Wave { - if (pVictim->GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x0000040000000000LL, 0, GetGUID())) + if (pVictim->GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, UI64LIT(0x0000040000000000), 0, GetGUID())) DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; break; } @@ -8328,7 +8328,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint // Taken mods // Healing Wave cast - if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags & 0x0000000000000040LL) + if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000040))) { // Search for Healing Way on Victim Unit::AuraList const& auraDummy = pVictim->GetAurasByType(SPELL_AURA_DUMMY); @@ -8626,7 +8626,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT if(spellProto==NULL) break; // Should increase Shred (initial Damage of Lacerate and Rake handled in Spell::EffectSchoolDMG) - if(spellProto->SpellFamilyName==SPELLFAMILY_DRUID && (spellProto->SpellFamilyFlags==0x00008000LL)) + if(spellProto->SpellFamilyName==SPELLFAMILY_DRUID && (spellProto->SpellFamilyFlags == UI64LIT(0x00008000))) TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; break; } @@ -10325,13 +10325,15 @@ CharmInfo::CharmInfo(Unit* unit) void CharmInfo::InitPetActionBar() { // the first 3 SpellOrActions are attack, follow and stay + // last 3 SpellOrActions are reactions for(uint32 i = 0; i < 3; ++i) { SetActionBar(i,COMMAND_ATTACK - i,ACT_COMMAND); SetActionBar(i + 7,COMMAND_ATTACK - i,ACT_REACTION); } + // middle 4 SpellOrActions are spells/special attacks/abilities for(uint32 i = 0; i < 4; ++i) - SetActionBar(i,0,ACT_DISABLED); + SetActionBar(i + 3,0,ACT_DISABLED); } void CharmInfo::InitEmptyActionBar() diff --git a/src/game/Unit.h b/src/game/Unit.h index b54c96317..e5946c6e8 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -921,6 +921,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void CombatStopWithPets(bool includingCast = false); Unit* SelectNearbyTarget() const; bool hasNegativeAuraWithInterruptFlag(uint32 flag); + void SendMeleeAttackStop(Unit* victim); + void SendMeleeAttackStart(Unit* pVictim); void addUnitState(uint32 f) { m_state |= f; } bool hasUnitState(const uint32 f) const { return (m_state & f); } @@ -1548,9 +1550,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject uint32 m_regenTimer; private: - void SendAttackStop(Unit* victim); // only from AttackStop(Unit*) - void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*) - bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent ); bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); diff --git a/src/game/World.cpp b/src/game/World.cpp index b9062760e..be629090d 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1374,7 +1374,7 @@ void World::SetInitialWorldSettings() sprintf( isoDate, "%04d-%02d-%02d %02d:%02d:%02d", local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec); - loginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " I64FMTD ", '%s', 0)", + loginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " UI64FMTD ", '%s', 0)", realmID, uint64(m_startTime), isoDate); m_timers[WUPDATE_OBJECTS].SetInterval(0); @@ -1544,7 +1544,7 @@ void World::Update(uint32 diff) uint32 maxClientsNum = GetMaxActiveSessionCount(); m_timers[WUPDATE_UPTIME].Reset(); - loginDatabase.PExecute("UPDATE uptime SET uptime = %u, maxplayers = %u WHERE realmid = %u AND starttime = " I64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime)); + loginDatabase.PExecute("UPDATE uptime SET uptime = %u, maxplayers = %u WHERE realmid = %u AND starttime = " UI64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime)); } ///
  • Handle all other objects diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 94d7cca07..4f8340ad3 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -119,8 +119,8 @@ void WorldSession::SendPacket(WorldPacket const* packet) { uint64 minTime = uint64(cur_time - lastTime); uint64 fullTime = uint64(lastTime - firstTime); - sLog.outDetail("Send all time packets count: " I64FMTD " bytes: " I64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u",sendPacketCount,sendPacketBytes,float(sendPacketCount)/fullTime,float(sendPacketBytes)/fullTime,uint32(fullTime)); - sLog.outDetail("Send last min packets count: " I64FMTD " bytes: " I64FMTD " avr.count/sec: %f avr.bytes/sec: %f",sendLastPacketCount,sendLastPacketBytes,float(sendLastPacketCount)/minTime,float(sendLastPacketBytes)/minTime); + sLog.outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u",sendPacketCount,sendPacketBytes,float(sendPacketCount)/fullTime,float(sendPacketBytes)/fullTime,uint32(fullTime)); + sLog.outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f",sendLastPacketCount,sendLastPacketBytes,float(sendLastPacketCount)/minTime,float(sendLastPacketBytes)/minTime); lastTime = cur_time; sendLastPacketCount = 1; diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 645897677..5a13ea788 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -370,7 +370,7 @@ class ByteBuffer { if ((i == (j*8)) && ((i != (k*16)))) { - if (read(i) < 0x0F) + if (read(i) < 0x10) { sLog.outDebugInLine("| 0%X ", read(i) ); } @@ -382,7 +382,7 @@ class ByteBuffer } else if (i == (k*16)) { - if (read(i) < 0x0F) + if (read(i) < 0x10) { sLog.outDebugInLine("\n"); if(sLog.IsIncludeTime()) @@ -404,7 +404,7 @@ class ByteBuffer } else { - if (read(i) < 0x0F) + if (read(i) < 0x10) { sLog.outDebugInLine("0%X ", read(i) ); } diff --git a/src/shared/Common.h b/src/shared/Common.h index d1efba3f9..4edd6e7f8 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -98,6 +98,7 @@ #include "LockedQueue.h" #include "Threading.h" +#include #include #include #include @@ -125,8 +126,6 @@ #include #define I64FMT "%016I64X" -#define I64FMTD "%I64u" -#define SI64FMTD "%I64d" #define snprintf _snprintf #define atoll __atoi64 #define vsnprintf _vsnprintf @@ -138,10 +137,15 @@ #define stricmp strcasecmp #define strnicmp strncasecmp #define I64FMT "%016llX" -#define I64FMTD "%llu" -#define SI64FMTD "%lld" + #endif +#define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER +#define UI64LIT(N) ACE_UINT64_LITERAL(N) + +#define SI64FMTD ACE_INT64_FORMAT_SPECIFIER +#define SI64LIT(N) ACE_INT64_LITERAL(N) + inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; } #define atol(a) strtoul( a, NULL, 10) diff --git a/src/shared/Database/Field.h b/src/shared/Database/Field.h index 9235c394f..e0ce21b91 100644 --- a/src/shared/Database/Field.h +++ b/src/shared/Database/Field.h @@ -57,7 +57,7 @@ class Field if(mValue) { uint64 value; - sscanf(mValue,I64FMTD,&value); + sscanf(mValue,UI64FMTD,&value); return value; } else diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 527d62ebb..6470b37e5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7911" + #define REVISION_NR "7928" #endif // __REVISION_NR_H__ diff --git a/src/shared/vmap/CoordModelMapping.cpp b/src/shared/vmap/CoordModelMapping.cpp index 2ce40dd8f..23b89fefd 100644 --- a/src/shared/vmap/CoordModelMapping.cpp +++ b/src/shared/vmap/CoordModelMapping.cpp @@ -85,63 +85,65 @@ namespace VMAP bool CoordModelMapping::readCoordinateMapping(const std::string& pDirectoryFileName) { FILE *f = fopen(pDirectoryFileName.c_str(), "rb"); - bool result = false; + if(!f) + { + printf("ERROR: Can't open file: %s\n",pDirectoryFileName.c_str()); + return false; + } + char buffer[500+1]; - if(f) + CMappingEntry* cMappingEntry; + while(fgets(buffer, 500, f)) { - result = true; - CMappingEntry* cMappingEntry; - while(fgets(buffer, 500, f)) + //char namebuffer[500]; + char positionbuffer[500]; + int xpos, ypos, noVec; + float scale; + xpos = ypos = noVec = 0; + + //sscanf(buffer, "%d %d %s %s %f %d", &xpos, &ypos, namebuffer,positionbuffer, &scale, &noVec); + + // this is ugly, but the format has no read delimiter and a space could be in the first part of the name + int nameStart = findPosChar(buffer, ' ', 2);// find the 2. space + if(nameStart > -1 && (iFilterMethod == NULL || (*iFilterMethod)(buffer))) { - //char namebuffer[500]; - char positionbuffer[500]; - int xpos, ypos, noVec; - float scale; - xpos = ypos = noVec = 0; + ++nameStart; + // find the 1. / (now a space only can be found at the end of the name) + int nameEnd = nameStart + findPosChar(&buffer[nameStart], '/', 1); + // find the 1. space (after the name) + nameEnd += findPosChar(&buffer[nameEnd], ' ', 1); + buffer[nameEnd] = 0; // terminate the name - //sscanf(buffer, "%d %d %s %s %f %d", &xpos, &ypos, namebuffer,positionbuffer, &scale, &noVec); - - // this is ugly, but the format has no read delimiter and a space could be in the first part of the name - int nameStart = findPosChar(buffer, ' ', 2);// find the 2. space - if(nameStart > -1 && (iFilterMethod == NULL || (*iFilterMethod)(buffer))) + sscanf(buffer, "%d %d", &xpos, &ypos); + sscanf(&buffer[nameEnd+1], "%s %f %d", positionbuffer, &scale, &noVec); + unsigned int mapId = getMapIdFromFilename(std::string(&buffer[nameStart])); + if(!iMapIds.contains(mapId)) { - ++nameStart; - // find the 1. / (now a space only can be found at the end of the name) - int nameEnd = nameStart + findPosChar(&buffer[nameStart], '/', 1); - // find the 1. space (after the name) - nameEnd += findPosChar(&buffer[nameEnd], ' ', 1); - buffer[nameEnd] = 0; // terminate the name - - sscanf(buffer, "%d %d", &xpos, &ypos); - sscanf(&buffer[nameEnd+1], "%s %f %d", positionbuffer, &scale, &noVec); - unsigned int mapId = getMapIdFromFilename(std::string(&buffer[nameStart])); - if(!iMapIds.contains(mapId)) - { - iMapIds.append(mapId); - } - if(!isWorldAreaMap(mapId)) - { - xpos = 0; // store all files under the groupKey - ypos = 0; - } - - std::string key = CMappingEntry::getKeyString(mapId, xpos, ypos); - cMappingEntry = getCMappingEntry(key); - if(cMappingEntry == 0) - { - cMappingEntry = new CMappingEntry(mapId, xpos, ypos); - addCMappingEntry(cMappingEntry); - } - char namebuffer2[500]; - sprintf(namebuffer2, "%d %s#%s_%f", noVec, &buffer[nameStart], positionbuffer, scale); - cMappingEntry->addFilename(namebuffer2); - //break; + iMapIds.append(mapId); + printf("Coords for map %u...\n",mapId); } + if(!isWorldAreaMap(mapId)) + { + xpos = 0; // store all files under the groupKey + ypos = 0; + } + + std::string key = CMappingEntry::getKeyString(mapId, xpos, ypos); + cMappingEntry = getCMappingEntry(key); + if(cMappingEntry == 0) + { + cMappingEntry = new CMappingEntry(mapId, xpos, ypos); + addCMappingEntry(cMappingEntry); + } + char namebuffer2[500]; + sprintf(namebuffer2, "%d %s#%s_%f", noVec, &buffer[nameStart], positionbuffer, scale); + cMappingEntry->addFilename(namebuffer2); + //break; } - fclose(f); } - return result; + fclose(f); + return true; } //============================================================ diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp index 7c4856251..b8434a7ef 100644 --- a/src/shared/vmap/TileAssembler.cpp +++ b/src/shared/vmap/TileAssembler.cpp @@ -148,446 +148,454 @@ namespace VMAP # endif #endif - bool result = true; std::string fname = iSrcDir; fname.append("/"); fname.append("dir"); iCoordModelMapping->setModelNameFilterMethod(iFilterMethod); - iCoordModelMapping->readCoordinateMapping(fname); + + printf("Read coordinate mapping...\n"); + if(!iCoordModelMapping->readCoordinateMapping(fname)) + return false; Array mapIds = iCoordModelMapping->getMaps(); if(mapIds.size() == 0) { - result = false; + printf("Fatal error: empty map list!\n"); + return false; } - for(int i=0; i mc; - std::string dirname; - char buffer[100]; - if(iCoordModelMapping->isWorldAreaMap(mapId) && x<65 && y<65) - { - sprintf(buffer, "%03u_%d_%d",mapId,y,x); // Let's flip x and y here - dirname = std::string(buffer); - } - else - { - sprintf(buffer, "%03u",mapId); - dirname = std::string(buffer); - } - result = fillModelContainerArray(dirname, mapId, x, y, mc); - emptyArray(mc); - } - } - } - } - #ifdef _ASSEMBLER_DEBUG - if(::g_df) fclose(::g_df); - #endif - - return result; - } - - //================================================================= - - bool TileAssembler::fillModelContainerArray(const std::string& pDirFileName, unsigned int pMapId, int pXPos, int pYPos, Array& pMC) + #else + // ignore DeeprunTram (369) it is too large for short vector and not important + // ignore test (13), Test (29) , development (451) + if(mapId != 369 && mapId != 13 && mapId != 29 && mapId != 451) + { + for(int x=0; x<66; ++x) { - bool result = true; - ModelContainer* modelContainer; - - NameCollection nameCollection = iCoordModelMapping->getFilenamesForCoordinate(pMapId, pXPos, pYPos); - if(nameCollection.size() > 0) + for(int y=0; y<66; ++y) { - result = false; - char dirfilename[500]; - sprintf(dirfilename,"%s/%s.vmdir",iDestDir.c_str(),pDirFileName.c_str()); - FILE *dirfile = fopen(dirfilename, "ab"); - if(dirfile) + #endif + Array mc; + std::string dirname; + char buffer[100]; + if(iCoordModelMapping->isWorldAreaMap(mapId) && x<65 && y<65) { - result = true; - char destnamebuffer[500]; - char fullnamedestnamebuffer[500]; - if(nameCollection.iMainFiles.size() >0) - { - sprintf(destnamebuffer,"%03u_%i_%i.vmap",pMapId, pYPos, pXPos); // flip it here too - std::string checkDoubleStr = std::string(dirfilename); - checkDoubleStr.append("##"); - checkDoubleStr.append(std::string(destnamebuffer)); - // Check, if same file already is in the same dir file - if(!iCoordModelMapping->isAlreadyProcessedSingleFile(checkDoubleStr)) - { - iCoordModelMapping->addAlreadyProcessedSingleFile(checkDoubleStr); - fprintf(dirfile, "%s\n",destnamebuffer); - sprintf(fullnamedestnamebuffer,"%s/%s",iDestDir.c_str(),destnamebuffer); - modelContainer = processNames(nameCollection.iMainFiles, fullnamedestnamebuffer); - if(modelContainer) - { - pMC.append(modelContainer); - } - else - { - result = false; - } - } - } - // process the large singe files - int pos = 0; - while(result && (pos < nameCollection.iSingeFiles.size())) - { - std::string destFileName = iDestDir; - destFileName.append("/"); - std::string dirEntryName = getDirEntryNameFromModName(pMapId,nameCollection.iSingeFiles[pos]); - std::string checkDoubleStr = std::string(dirfilename); - checkDoubleStr.append("##"); - checkDoubleStr.append(nameCollection.iSingeFiles[pos]); - // Check, if same file already is in the same dir file - if(!iCoordModelMapping->isAlreadyProcessedSingleFile(checkDoubleStr)) - { - iCoordModelMapping->addAlreadyProcessedSingleFile(checkDoubleStr); - fprintf(dirfile, "%s\n",dirEntryName.c_str()); - destFileName.append(dirEntryName); - - Array positionarray; - positionarray.append(nameCollection.iSingeFiles[pos]); - - if(!iCoordModelMapping->isAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos])) - { - modelContainer = processNames(positionarray, destFileName.c_str()); - iCoordModelMapping->addAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos]); - if(modelContainer) - { - pMC.append(modelContainer); - } - else - { - result = false; - } - } - } - ++pos; - } - fclose(dirfile); - } - } - return(result); - } - - //================================================================= - - void removeEntriesFromTree(AABSPTree* pTree) - { - Array submodelArray; - pTree->getMembers(submodelArray); - int no = submodelArray.size(); - while(no > 0) - { - --no; - delete submodelArray[no]; - } - } - - //================================================================= - - ModelContainer* TileAssembler::processNames(const Array& pPositions, const char* pDestFileName) - { - ModelContainer *modelContainer = 0; - - Vector3 basepos = Vector3(0,0,0); - AABSPTree* mainTree = new AABSPTree(); - - int pos = 0; - - bool result = true; - while(result && (pos < pPositions.size())) - { - std::string modelPosString = pPositions[pos]; - std::string modelFileName = getModNameFromModPosName(modelPosString); - - if(!fillModelIntoTree(mainTree, basepos, modelPosString, modelFileName)) - { - result = false; - break; - } - ++pos; - } - if(result && mainTree->size() > 0) - { - mainTree->balance(); - modelContainer = new ModelContainer(mainTree); - modelContainer->writeFile(pDestFileName); - } - removeEntriesFromTree(mainTree); - - delete mainTree; - - return(modelContainer); - } - - //================================================================= - bool TileAssembler::readRawFile(std::string& pModelFilename, ModelPosition& pModelPosition, AABSPTree *pMainTree) - { - bool result = false; - - std::string filename = iSrcDir; - if(filename.length() >0) - filename.append("/"); - filename.append(pModelFilename); - FILE *rf = fopen(filename.c_str(), "rb"); - if(!rf) - { - // depending on the extractor version, the data could be located in the root dir - std::string baseModelFilename = pModelFilename.substr((pModelFilename.find_first_of("/")+1),pModelFilename.length()); - filename = iSrcDir; - if(filename.length() >0) - filename.append("/"); - filename.append(baseModelFilename); - rf = fopen(filename.c_str(), "rb"); - } - char ident[8]; - - int trianglecount =0; - - #ifdef _ASSEMBLER_DEBUG - int startgroup = 0; //2; - int endgroup = INT_MAX; //2; - fprintf(::g_df,"-------------------------------------------------\n"); - fprintf(::g_df,"%s\n", pModelFilename.c_str()); - fprintf(::g_df,"-------------------------------------------------\n"); - #else - int startgroup = 0; - int endgroup = INT_MAX; - #endif - - // temporary use defines to simplify read/check code (close file and return at fail) - #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { fclose(rf); return(false); } - #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { fclose(rf); return(false); } - - if(rf) - { - READ_OR_RETURN(&ident, 8); - if(strcmp(ident, "VMAP001") == 0) - { - // OK, do nothing - } - else if(strcmp(ident, "VMAP002") == 0) - { - // we have to read one int. This is needed during the export and we have to skip it here - int tempNVectors; - READ_OR_RETURN(&tempNVectors, sizeof(int)); - + sprintf(buffer, "%03u_%d_%d",mapId,y,x); // Let's flip x and y here + dirname = std::string(buffer); + printf("%s...\n",dirname.c_str()); } else { - // wrong version - fclose(rf); - return(false); + sprintf(buffer, "%03u",mapId); + dirname = std::string(buffer); + + // prevent spam for small maps + if(x==0 && y==0) + printf("%s...\n",dirname.c_str()); } - G3D::uint32 groups; - char blockId[5]; - blockId[4] = 0; - int blocksize; - READ_OR_RETURN(&groups, sizeof(G3D::uint32)); + bool result = fillModelContainerArray(dirname, mapId, x, y, mc); + emptyArray(mc); - for(int g=0;g<(int)groups;g++) - { - // group MUST NOT have more then 65536 indexes !! Array will have a problem with that !! (strange ...) - Array tempIndexArray; - Array tempVertexArray; - - AABSPTree *gtree = new AABSPTree(); - - // add free gtree at fail - #undef READ_OR_RETURN - #undef CMP_OR_RETURN - #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { fclose(rf); delete gtree; return(false); } - #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { fclose(rf); delete gtree; return(false); } - - G3D::uint32 flags; - READ_OR_RETURN(&flags, sizeof(G3D::uint32)); - - G3D::uint32 branches; - READ_OR_RETURN(&blockId, 4); - CMP_OR_RETURN(blockId, "GRP "); - READ_OR_RETURN(&blocksize, sizeof(int)); - READ_OR_RETURN(&branches, sizeof(G3D::uint32)); - for(int b=0;b<(int)branches; b++) - { - G3D::uint32 indexes; - // indexes for each branch (not used jet) - READ_OR_RETURN(&indexes, sizeof(G3D::uint32)); - } - - // ---- indexes - READ_OR_RETURN(&blockId, 4); - CMP_OR_RETURN(blockId, "INDX"); - READ_OR_RETURN(&blocksize, sizeof(int)); - unsigned int nindexes; - READ_OR_RETURN(&nindexes, sizeof(G3D::uint32)); - if(nindexes >0) - { - unsigned short *indexarray = new unsigned short[nindexes*sizeof(unsigned short)]; - READ_OR_RETURN(indexarray, sizeof(unsigned short)); - for(int i=0;i<(int)nindexes; i++) - { - unsigned short val = indexarray[i]; - tempIndexArray.append(val); - } - delete[] indexarray; - } - - // ---- vectors - READ_OR_RETURN(&blockId, 4); - CMP_OR_RETURN(blockId, "VERT"); - READ_OR_RETURN(&blocksize, sizeof(int)); - unsigned int nvectors; - READ_OR_RETURN(&nvectors, sizeof(int)); - - float *vectorarray = 0; - - // add vectorarray free - #undef READ_OR_RETURN - #undef CMP_OR_RETURN - #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { fclose(rf); delete gtree; delete[] vectorarray; return(false); } - #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { fclose(rf); delete gtree; delete[] vectorarray; return(false); } - - if(nvectors >0) - { - vectorarray = new float[nvectors*sizeof(float)*3]; - READ_OR_RETURN(vectorarray, sizeof(float)*3); - } - // ----- liquit - if(flags & 1) - { - // we have liquit -> not handled yet ... skip - READ_OR_RETURN(&blockId, 4); - CMP_OR_RETURN(blockId, "LIQU"); - READ_OR_RETURN(&blocksize, sizeof(int)); - fseek(rf, blocksize, SEEK_CUR); - } - - - for(unsigned int i=0, indexNo=0; indexNo= startgroup && g <= endgroup) - { - gtree->insert(t); - } - } - - // drop of temporary use defines - #undef READ_OR_RETURN - #undef CMP_OR_RETURN - - if(vectorarray != 0) - { - delete vectorarray; - } - - if(gtree->size() >0) - { - gtree->balance(); - SubModel *sm = new SubModel(gtree); - #ifdef _ASSEMBLER_DEBUG - if(::g_df) fprintf(::g_df,"group trianglies: %d, Tris: %d, Nodes: %d, gtree.triangles: %d\n", g, sm->getNTriangles(), sm->getNNodes(), gtree->memberTable.size()); - if(sm->getNTriangles() != gtree->memberTable.size()) - { - if(::g_df) fprintf(::g_df,"ERROR !!!! group trianglies: %d, Tris: %d, Nodes: %d, gtree.triangles: %d\n", g, sm->getNTriangles(), sm->getNNodes(), gtree->memberTable.size()); - } - #endif - sm->setBasePosition(pModelPosition.iPos); - pMainTree->insert(sm); - } - delete gtree; - } - fclose(rf); - result = true; + if(!result) + return false; } - return(result); } + } + } + #ifdef _ASSEMBLER_DEBUG + if(::g_df) fclose(::g_df); + #endif - //================================================================= + return true; + } - bool TileAssembler::fillModelIntoTree(AABSPTree *pMainTree, const Vector3& pBasePos, std::string& pPos, std::string& pModelFilename) + //================================================================= + + bool TileAssembler::fillModelContainerArray(const std::string& pDirFileName, unsigned int pMapId, int pXPos, int pYPos, Array& pMC) + { + ModelContainer* modelContainer; + + NameCollection nameCollection = iCoordModelMapping->getFilenamesForCoordinate(pMapId, pXPos, pYPos); + if(nameCollection.size() == 0) + return true; // no data... + + char dirfilename[500]; + sprintf(dirfilename,"%s/%s.vmdir",iDestDir.c_str(),pDirFileName.c_str()); + FILE *dirfile = fopen(dirfilename, "ab"); + if(!dirfile) + { + printf("ERROR: Can't create file %s",dirfilename); + return false; + } + + char destnamebuffer[500]; + char fullnamedestnamebuffer[500]; + + if(nameCollection.iMainFiles.size() >0) + { + sprintf(destnamebuffer,"%03u_%i_%i.vmap",pMapId, pYPos, pXPos); // flip it here too + std::string checkDoubleStr = std::string(dirfilename); + checkDoubleStr.append("##"); + checkDoubleStr.append(std::string(destnamebuffer)); + // Check, if same file already is in the same dir file + if(!iCoordModelMapping->isAlreadyProcessedSingleFile(checkDoubleStr)) + { + iCoordModelMapping->addAlreadyProcessedSingleFile(checkDoubleStr); + fprintf(dirfile, "%s\n",destnamebuffer); + sprintf(fullnamedestnamebuffer,"%s/%s",iDestDir.c_str(),destnamebuffer); + modelContainer = processNames(nameCollection.iMainFiles, fullnamedestnamebuffer); + if(modelContainer) + pMC.append(modelContainer); + else + printf("warning: (if) problems in processing data for %s\n",destnamebuffer); + } + } + // process the large singe files + int pos = 0; + while(pos < nameCollection.iSingeFiles.size()) + { + std::string destFileName = iDestDir; + destFileName.append("/"); + std::string dirEntryName = getDirEntryNameFromModName(pMapId,nameCollection.iSingeFiles[pos]); + std::string checkDoubleStr = std::string(dirfilename); + checkDoubleStr.append("##"); + checkDoubleStr.append(nameCollection.iSingeFiles[pos]); + // Check, if same file already is in the same dir file + if(!iCoordModelMapping->isAlreadyProcessedSingleFile(checkDoubleStr)) + { + iCoordModelMapping->addAlreadyProcessedSingleFile(checkDoubleStr); + fprintf(dirfile, "%s\n",dirEntryName.c_str()); + destFileName.append(dirEntryName); + + Array positionarray; + positionarray.append(nameCollection.iSingeFiles[pos]); + + if(!iCoordModelMapping->isAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos])) { - bool result = false; - ModelPosition modelPosition; - getModelPosition(pPos, modelPosition); - // all should be relative to object base position - modelPosition.moveToBasePos(pBasePos); - - modelPosition.init(); - - if(readRawFile(pModelFilename, modelPosition, pMainTree)) - { - result = true; - } - - return result; + modelContainer = processNames(positionarray, destFileName.c_str()); + iCoordModelMapping->addAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos]); + if(modelContainer) + pMC.append(modelContainer); + else + printf("warning: (while) problems in processing data for %s\n",destFileName.c_str()); } + } + ++pos; + } - //================================================================= - void TileAssembler::getModelPosition(std::string& pPosString, ModelPosition& pModelPosition) + fclose(dirfile); + return true; + } + + //================================================================= + + void removeEntriesFromTree(AABSPTree* pTree) + { + Array submodelArray; + pTree->getMembers(submodelArray); + int no = submodelArray.size(); + while(no > 0) + { + --no; + delete submodelArray[no]; + } + } + + //================================================================= + + ModelContainer* TileAssembler::processNames(const Array& pPositions, const char* pDestFileName) + { + ModelContainer *modelContainer = 0; + + Vector3 basepos = Vector3(0,0,0); + AABSPTree* mainTree = new AABSPTree(); + + int pos = 0; + + bool result = true; + while(result && (pos < pPositions.size())) + { + std::string modelPosString = pPositions[pos]; + std::string modelFileName = getModNameFromModPosName(modelPosString); + + if(!fillModelIntoTree(mainTree, basepos, modelPosString, modelFileName)) + { + result = false; + break; + } + ++pos; + } + if(result && mainTree->size() > 0) + { + mainTree->balance(); + modelContainer = new ModelContainer(mainTree); + modelContainer->writeFile(pDestFileName); + } + removeEntriesFromTree(mainTree); + + delete mainTree; + + return(modelContainer); + } + + //================================================================= + bool TileAssembler::readRawFile(std::string& pModelFilename, ModelPosition& pModelPosition, AABSPTree *pMainTree) + { + std::string filename = iSrcDir; + if(filename.length() >0) + filename.append("/"); + filename.append(pModelFilename); + FILE *rf = fopen(filename.c_str(), "rb"); + if(!rf) + { + // depending on the extractor version, the data could be located in the root dir + std::string baseModelFilename = pModelFilename.substr((pModelFilename.find_first_of("/")+1),pModelFilename.length()); + filename = iSrcDir; + if(filename.length() >0) + filename.append("/"); + filename.append(baseModelFilename); + rf = fopen(filename.c_str(), "rb"); + } + + if(!rf) + { + printf("ERROR: Can't open model file in form: %s",pModelFilename.c_str()); + printf("... or form: %s",filename ); + return false; + } + + char ident[8]; + + int trianglecount =0; + + #ifdef _ASSEMBLER_DEBUG + int startgroup = 0; //2; + int endgroup = INT_MAX; //2; + fprintf(::g_df,"-------------------------------------------------\n"); + fprintf(::g_df,"%s\n", pModelFilename.c_str()); + fprintf(::g_df,"-------------------------------------------------\n"); + #else + int startgroup = 0; + int endgroup = INT_MAX; + #endif + + // temporary use defines to simplify read/check code (close file and return at fail) + #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \ + fclose(rf); return(false); } + #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \ + fclose(rf); return(false); } + + READ_OR_RETURN(&ident, 8); + if(strcmp(ident, "VMAP001") == 0) + { + // OK, do nothing + } + else if(strcmp(ident, "VMAP002") == 0) + { + // we have to read one int. This is needed during the export and we have to skip it here + int tempNVectors; + READ_OR_RETURN(&tempNVectors, sizeof(int)); + + } + else + { + // wrong version + fclose(rf); + return(false); + } + G3D::uint32 groups; + char blockId[5]; + blockId[4] = 0; + int blocksize; + + READ_OR_RETURN(&groups, sizeof(G3D::uint32)); + + for(int g=0;g<(int)groups;g++) + { + // group MUST NOT have more then 65536 indexes !! Array will have a problem with that !! (strange ...) + Array tempIndexArray; + Array tempVertexArray; + + AABSPTree *gtree = new AABSPTree(); + + // add free gtree at fail + #undef READ_OR_RETURN + #undef CMP_OR_RETURN + #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \ + fclose(rf); delete gtree; return(false); } + #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \ + fclose(rf); delete gtree; return(false); } + + G3D::uint32 flags; + READ_OR_RETURN(&flags, sizeof(G3D::uint32)); + + G3D::uint32 branches; + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "GRP "); + READ_OR_RETURN(&blocksize, sizeof(int)); + READ_OR_RETURN(&branches, sizeof(G3D::uint32)); + for(int b=0;b<(int)branches; b++) + { + G3D::uint32 indexes; + // indexes for each branch (not used jet) + READ_OR_RETURN(&indexes, sizeof(G3D::uint32)); + } + + // ---- indexes + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "INDX"); + READ_OR_RETURN(&blocksize, sizeof(int)); + unsigned int nindexes; + READ_OR_RETURN(&nindexes, sizeof(G3D::uint32)); + if(nindexes >0) + { + unsigned short *indexarray = new unsigned short[nindexes*sizeof(unsigned short)]; + READ_OR_RETURN(indexarray, nindexes*sizeof(unsigned short)); + for(int i=0;i<(int)nindexes; i++) { - float vposarray[3]; - float vdirarray[3]; - float scale; - - size_t spos = pPosString.find_first_of('#'); - std::string stripedPosString = pPosString.substr(spos+1,pPosString.length()); - - sscanf(stripedPosString.c_str(), "%f,%f,%f_%f,%f,%f_%f", - &vposarray[0],&vposarray[1],&vposarray[2], - &vdirarray[0],&vdirarray[1],&vdirarray[2], - &scale); - - pModelPosition.iPos = Vector3(vposarray[0], vposarray[1], vposarray[2]); - pModelPosition.iDir = Vector3(vdirarray[0], vdirarray[1], vdirarray[2]); - pModelPosition.iScale = scale; - + unsigned short val = indexarray[i]; + tempIndexArray.append(val); } - //========================================== + delete[] indexarray; + } - } // VMAP + // ---- vectors + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "VERT"); + READ_OR_RETURN(&blocksize, sizeof(int)); + unsigned int nvectors; + READ_OR_RETURN(&nvectors, sizeof(int)); + + float *vectorarray = 0; + + // add vectorarray free + #undef READ_OR_RETURN + #undef CMP_OR_RETURN + #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \ + fclose(rf); delete gtree; delete[] vectorarray; return(false); } + #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \ + fclose(rf); delete gtree; delete[] vectorarray; return(false); } + + if(nvectors >0) + { + vectorarray = new float[nvectors*sizeof(float)*3]; + READ_OR_RETURN(vectorarray, nvectors*sizeof(float)*3); + } + // ----- liquit + if(flags & 1) + { + // we have liquit -> not handled yet ... skip + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "LIQU"); + READ_OR_RETURN(&blocksize, sizeof(int)); + fseek(rf, blocksize, SEEK_CUR); + } + + + for(unsigned int i=0, indexNo=0; indexNo= startgroup && g <= endgroup) + { + gtree->insert(t); + } + } + + // drop of temporary use defines + #undef READ_OR_RETURN + #undef CMP_OR_RETURN + + if(vectorarray != 0) + { + delete vectorarray; + } + + if(gtree->size() >0) + { + gtree->balance(); + SubModel *sm = new SubModel(gtree); + #ifdef _ASSEMBLER_DEBUG + if(::g_df) fprintf(::g_df,"group trianglies: %d, Tris: %d, Nodes: %d, gtree.triangles: %d\n", g, sm->getNTriangles(), sm->getNNodes(), gtree->memberTable.size()); + if(sm->getNTriangles() != gtree->memberTable.size()) + { + if(::g_df) fprintf(::g_df,"ERROR !!!! group trianglies: %d, Tris: %d, Nodes: %d, gtree.triangles: %d\n", g, sm->getNTriangles(), sm->getNNodes(), gtree->memberTable.size()); + } + #endif + sm->setBasePosition(pModelPosition.iPos); + pMainTree->insert(sm); + } + delete gtree; + } + fclose(rf); + return true; + } + + //================================================================= + + bool TileAssembler::fillModelIntoTree(AABSPTree *pMainTree, const Vector3& pBasePos, std::string& pPos, std::string& pModelFilename) + { + ModelPosition modelPosition; + getModelPosition(pPos, modelPosition); + // all should be relative to object base position + modelPosition.moveToBasePos(pBasePos); + + modelPosition.init(); + + return readRawFile(pModelFilename, modelPosition, pMainTree); + } + + //================================================================= + void TileAssembler::getModelPosition(std::string& pPosString, ModelPosition& pModelPosition) + { + float vposarray[3]; + float vdirarray[3]; + float scale; + + size_t spos = pPosString.find_first_of('#'); + std::string stripedPosString = pPosString.substr(spos+1,pPosString.length()); + + sscanf(stripedPosString.c_str(), "%f,%f,%f_%f,%f,%f_%f", + &vposarray[0],&vposarray[1],&vposarray[2], + &vdirarray[0],&vdirarray[1],&vdirarray[2], + &scale); + + pModelPosition.iPos = Vector3(vposarray[0], vposarray[1], vposarray[2]); + pModelPosition.iDir = Vector3(vdirarray[0], vdirarray[1], vdirarray[2]); + pModelPosition.iScale = scale; + + } + //========================================== +} // VMAP