diff options
| author | Shauren <shauren.trinity@gmail.com> | 2013-03-15 20:09:48 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2013-03-15 20:09:48 +0100 |
| commit | e58e05d9d5da894447b81ded17c3b8fd9f4820a8 (patch) | |
| tree | e41b9ed702da6dc1063e8bddd0f270c2d47f0d7b /src/server/scripts/Commands | |
| parent | 51b9e6d2c947d2151af09d7a25af45ff75b0d530 (diff) | |
| parent | 11846f5990f5af421ff2fc087925245f61b4ac84 (diff) | |
Merge branch '4.3.4' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src/server/scripts/Commands')
| -rw-r--r-- | src/server/scripts/Commands/cs_character.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_cheat.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_debug.cpp | 35 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_gm.cpp | 9 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_go.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_gobject.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_guild.cpp | 1 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_learn.cpp | 25 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_list.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_lookup.cpp | 465 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 34 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_modify.cpp | 106 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 14 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_reload.cpp | 178 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_reset.cpp | 7 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_titles.cpp | 6 | ||||
| -rw-r--r-- | src/server/scripts/Commands/cs_wp.cpp | 64 |
17 files changed, 403 insertions, 557 deletions
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index c29b62975ab..1ed00f32b87 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -277,7 +277,7 @@ public: if (titleInfo && target->HasTitle(titleInfo)) { - std::string name = titleInfo->name[loc]; + std::string name = titleInfo->name; if (name.empty()) continue; @@ -473,7 +473,7 @@ public: { FactionState const& faction = itr->second; FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID); - char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#"; + char const* factionName = factionEntry ? factionEntry->name : "#Not found#"; ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); std::string rankName = handler->GetTrinityString(ReputationRankStrIndex[rank]); std::ostringstream ss; diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp index 9dbc9900e58..3ca81e3e6f3 100644 --- a/src/server/scripts/Commands/cs_cheat.cpp +++ b/src/server/scripts/Commands/cs_cheat.cpp @@ -197,14 +197,14 @@ public: if (argstr == "off") { handler->GetSession()->GetPlayer()->SetCommandStatusOff(CHEAT_WATERWALK); - handler->GetSession()->GetPlayer()->SetMovement(MOVE_LAND_WALK); // OFF + handler->GetSession()->GetPlayer()->SendMovementSetWaterWalking(false); // OFF handler->SendSysMessage("Waterwalking is OFF. You can't walk on water."); return true; } else if (argstr == "on") { handler->GetSession()->GetPlayer()->SetCommandStatusOn(CHEAT_WATERWALK); - handler->GetSession()->GetPlayer()->SetMovement(MOVE_WATER_WALK); // ON + handler->GetSession()->GetPlayer()->SendMovementSetWaterWalking(true); // ON handler->SendSysMessage("Waterwalking is ON. You can walk on water."); return true; } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 400e35b705b..56b8d251de6 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -91,6 +91,7 @@ public: { "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "", NULL }, { "los", SEC_MODERATOR, false, &HandleDebugLoSCommand, "", NULL }, { "moveflags", SEC_ADMINISTRATOR, false, &HandleDebugMoveflagsCommand, "", NULL }, + { "phase", SEC_MODERATOR, false, &HandleDebugPhaseCommand, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand commandTable[] = @@ -237,7 +238,7 @@ public: return false; SellResult msg = SellResult(atoi(args)); - handler->GetSession()->GetPlayer()->SendSellError(msg, 0, 0, 0); + handler->GetSession()->GetPlayer()->SendSellError(msg, 0, 0); return true; } @@ -311,7 +312,7 @@ public: uint32 opcode; parsedStream >> opcode; - WorldPacket data(opcode, 0); + WorldPacket data(Opcodes(opcode), 0); while (!parsedStream.eof()) { @@ -417,7 +418,7 @@ public: } sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending opcode %u", data.GetOpcode()); data.hexlike(); - player->GetSession()->SendPacket(&data); + player->GetSession()->SendPacket(&data, true); handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName().c_str()); return true; } @@ -951,8 +952,21 @@ public: if (!*args) return false; - uint32 PhaseShift = atoi(args); - handler->GetSession()->SendSetPhaseShift(PhaseShift); + char* t = strtok((char*)args, " "); + char* p = strtok(NULL, " "); + + if (!t) + return false; + + std::set<uint32> terrainswap; + std::set<uint32> phaseId; + + terrainswap.insert((uint32)atoi(t)); + + if (p) + phaseId.insert((uint32)atoi(p)); + + handler->GetSession()->SendSetPhaseShift(phaseId, terrainswap); return true; } @@ -1333,6 +1347,17 @@ public: handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); return true; } + + static bool HandleDebugPhaseCommand(ChatHandler* handler, char const* /*args*/) + { + Unit* unit = handler->getSelectedUnit(); + Player* player = handler->GetSession()->GetPlayer(); + if (unit && unit->GetTypeId() == TYPEID_PLAYER) + player = unit->ToPlayer(); + + player->GetPhaseMgr().SendDebugReportToPlayer(handler->GetSession()->GetPlayer()); + return true; + } }; void AddSC_debug_commandscript() diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 168a5ec60b8..a99957a07c0 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -101,19 +101,16 @@ public: if (!target) target = handler->GetSession()->GetPlayer(); - WorldPacket data(12); + WorldPacket data; if (strncmp(args, "on", 3) == 0) - data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); + target->SendMovementSetCanFly(true); else if (strncmp(args, "off", 4) == 0) - data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); + target->SendMovementSetCanFly(false); else { handler->SendSysMessage(LANG_USE_BOL); return false; } - data.append(target->GetPackGUID()); - data << uint32(0); // unknown - target->SendMessageToSet(&data, true); handler->PSendSysMessage(LANG_COMMAND_FLYMODE_STATUS, handler->GetNameLink(target).c_str(), args); return true; } diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 11aa02ce648..75135199902 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -446,7 +446,7 @@ public: if (map->Instanceable()) { - handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->area_name[handler->GetSessionDbcLocale()], map->GetId(), map->GetMapName()); + handler->PSendSysMessage(LANG_INVALID_ZONE_MAP, areaEntry->ID, areaEntry->area_name, map->GetId(), map->GetMapName()); handler->SetSentErrorMessage(true); return false; } diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index f99e51fb260..3bdd0fbe132 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -152,7 +152,7 @@ public: GameObject* object = new GameObject; uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) + if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMgr().GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { delete object; return false; @@ -165,7 +165,7 @@ public: } // fill the gameobject data and save to the db - object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn()); + object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMgr().GetPhaseMaskForSpawn()); // this will generate a new guid if the object is in an instance if (!object->LoadGameObjectFromDB(guidLow, map)) diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp index afe792048f6..05f4e2bde67 100644 --- a/src/server/scripts/Commands/cs_guild.cpp +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -22,6 +22,7 @@ Comment: All guild related commands Category: commandscripts EndScriptData */ +#include "AchievementMgr.h" #include "Chat.h" #include "Language.h" #include "Guild.h" diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index 4c01b89a3ae..c1bbfd8affb 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -397,33 +397,14 @@ public: !skillInfo->canLink) // only prof with recipes have set continue; - int locale = handler->GetSessionDbcLocale(); - name = skillInfo->name[locale]; + name = skillInfo->name; if (name.empty()) continue; if (!Utf8FitTo(name, namePart)) - { - locale = 0; - for (; locale < TOTAL_LOCALES; ++locale) - { - if (locale == handler->GetSessionDbcLocale()) - continue; - - name = skillInfo->name[locale]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, namePart)) - break; - } - } + continue; - if (locale < TOTAL_LOCALES) - { - targetSkillInfo = skillInfo; - break; - } + targetSkillInfo = skillInfo; } if (!targetSkillInfo) diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index fce1f77c2cf..2ae91f4670d 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -437,7 +437,7 @@ public: AuraApplication const* aurApp = itr->second; Aura const* aura = aurApp->GetBase(); - char const* name = aura->GetSpellInfo()->SpellName[handler->GetSessionDbcLocale()]; + char const* name = aura->GetSpellInfo()->SpellName; std::ostringstream ss_name; ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r"; diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 2130e61cb47..e28251bebb4 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -106,48 +106,30 @@ public: AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag); if (areaEntry) { - int locale = handler->GetSessionDbcLocale(); - std::string name = areaEntry->area_name[locale]; + std::string name = areaEntry->area_name; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - { - locale = 0; - for (; locale < TOTAL_LOCALES; ++locale) - { - if (locale == handler->GetSessionDbcLocale()) - continue; - - name = areaEntry->area_name[locale]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wNamePart)) - break; - } - } + continue; - if (locale < TOTAL_LOCALES) + if (maxResults && count++ == maxResults) { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - // send area in "id - [name]" format - std::ostringstream ss; - if (handler->GetSession()) - ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << ' ' << localeNames[locale]<< "]|h|r"; - else - ss << areaEntry->ID << " - " << name << ' ' << localeNames[locale]; + // send area in "id - [name]" format + std::ostringstream ss; + if (handler->GetSession()) + ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name<< "]|h|r"; + else + ss << areaEntry->ID << " - " << name; - handler->SendSysMessage(ss.str().c_str()); + handler->SendSysMessage(ss.str().c_str()); - if (!found) - found = true; - } + if (!found) + found = true; } } @@ -313,77 +295,58 @@ public: for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id) { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(id); - if (factionEntry) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(id)) { FactionState const* factionState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL; - int locale = handler->GetSessionDbcLocale(); - std::string name = factionEntry->name[locale]; + std::string name = factionEntry->name; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - { - locale = 0; - for (; locale < TOTAL_LOCALES; ++locale) - { - if (locale == handler->GetSessionDbcLocale()) - continue; - - name = factionEntry->name[locale]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wNamePart)) - break; - } - } + continue; - if (locale < TOTAL_LOCALES) + if (maxResults && count++ == maxResults) { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format - // or "id - [faction] [no reputation]" format - std::ostringstream ss; - if (handler->GetSession()) - ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << ' ' << localeNames[locale] << "]|h|r"; - else - ss << id << " - " << name << ' ' << localeNames[locale]; + // send faction in "id - [faction] rank reputation [visible] [at war] [own team] [unknown] [invisible] [inactive]" format + // or "id - [faction] [no reputation]" format + std::ostringstream ss; + if (handler->GetSession()) + ss << id << " - |cffffffff|Hfaction:" << id << "|h[" << name << "]|h|r"; + else + ss << id << " - " << name; - if (factionState) // and then target != NULL also - { - uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry); - std::string rankName = handler->GetTrinityString(index); - - ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')'; - - if (factionState->Flags & FACTION_FLAG_VISIBLE) - ss << handler->GetTrinityString(LANG_FACTION_VISIBLE); - if (factionState->Flags & FACTION_FLAG_AT_WAR) - ss << handler->GetTrinityString(LANG_FACTION_ATWAR); - if (factionState->Flags & FACTION_FLAG_PEACE_FORCED) - ss << handler->GetTrinityString(LANG_FACTION_PEACE_FORCED); - if (factionState->Flags & FACTION_FLAG_HIDDEN) - ss << handler->GetTrinityString(LANG_FACTION_HIDDEN); - if (factionState->Flags & FACTION_FLAG_INVISIBLE_FORCED) - ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); - if (factionState->Flags & FACTION_FLAG_INACTIVE) - ss << handler->GetTrinityString(LANG_FACTION_INACTIVE); - } - else - ss << handler->GetTrinityString(LANG_FACTION_NOREPUTATION); + if (factionState) // and then target != NULL also + { + uint32 index = target->GetReputationMgr().GetReputationRankStrIndex(factionEntry); + std::string rankName = handler->GetTrinityString(index); + + ss << ' ' << rankName << "|h|r (" << target->GetReputationMgr().GetReputation(factionEntry) << ')'; + + if (factionState->Flags & FACTION_FLAG_VISIBLE) + ss << handler->GetTrinityString(LANG_FACTION_VISIBLE); + if (factionState->Flags & FACTION_FLAG_AT_WAR) + ss << handler->GetTrinityString(LANG_FACTION_ATWAR); + if (factionState->Flags & FACTION_FLAG_PEACE_FORCED) + ss << handler->GetTrinityString(LANG_FACTION_PEACE_FORCED); + if (factionState->Flags & FACTION_FLAG_HIDDEN) + ss << handler->GetTrinityString(LANG_FACTION_HIDDEN); + if (factionState->Flags & FACTION_FLAG_INVISIBLE_FORCED) + ss << handler->GetTrinityString(LANG_FACTION_INVISIBLE_FORCED); + if (factionState->Flags & FACTION_FLAG_INACTIVE) + ss << handler->GetTrinityString(LANG_FACTION_INACTIVE); + } + else + ss << handler->GetTrinityString(LANG_FACTION_NOREPUTATION); - handler->SendSysMessage(ss.str().c_str()); + handler->SendSysMessage(ss.str().c_str()); - if (!found) - found = true; - } + if (!found) + found = true; } } @@ -498,45 +461,27 @@ public: ItemSetEntry const* set = sItemSetStore.LookupEntry(id); if (set) { - int locale = handler->GetSessionDbcLocale(); - std::string name = set->name[locale]; + std::string name = set->name; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - { - locale = 0; - for (; locale < TOTAL_LOCALES; ++locale) - { - if (locale == handler->GetSessionDbcLocale()) - continue; - - name = set->name[locale]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wNamePart)) - break; - } - } + continue; - if (locale < TOTAL_LOCALES) + if (maxResults && count++ == maxResults) { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - // send item set in "id - [namedlink locale]" format - if (handler->GetSession()) - handler->PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), localeNames[locale]); - else - handler->PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), localeNames[locale]); + // send item set in "id - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_ITEMSET_LIST_CHAT, id, id, name.c_str(), ""); + else + handler->PSendSysMessage(LANG_ITEMSET_LIST_CONSOLE, id, name.c_str(), ""); - if (!found) - found = true; - } + if (!found) + found = true; } } if (!found) @@ -779,59 +724,41 @@ public: SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id); if (skillInfo) { - int locale = handler->GetSessionDbcLocale(); - std::string name = skillInfo->name[locale]; + std::string name = skillInfo->name; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - { - locale = 0; - for (; locale < TOTAL_LOCALES; ++locale) - { - if (locale == handler->GetSessionDbcLocale()) - continue; - - name = skillInfo->name[locale]; - if (name.empty()) - continue; + continue; - if (Utf8FitTo(name, wNamePart)) - break; - } + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; } - if (locale < TOTAL_LOCALES) + char valStr[50] = ""; + char const* knownStr = ""; + if (target && target->HasSkill(id)) { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } - - char valStr[50] = ""; - char const* knownStr = ""; - if (target && target->HasSkill(id)) - { - knownStr = handler->GetTrinityString(LANG_KNOWN); - uint32 curValue = target->GetPureSkillValue(id); - uint32 maxValue = target->GetPureMaxSkillValue(id); - uint32 permValue = target->GetSkillPermBonusValue(id); - uint32 tempValue = target->GetSkillTempBonusValue(id); - - char const* valFormat = handler->GetTrinityString(LANG_SKILL_VALUES); - snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue); - } + knownStr = handler->GetTrinityString(LANG_KNOWN); + uint32 curValue = target->GetPureSkillValue(id); + uint32 maxValue = target->GetPureMaxSkillValue(id); + uint32 permValue = target->GetSkillPermBonusValue(id); + uint32 tempValue = target->GetSkillTempBonusValue(id); + + char const* valFormat = handler->GetTrinityString(LANG_SKILL_VALUES); + snprintf(valStr, 50, valFormat, curValue, maxValue, permValue, tempValue); + } - // send skill in "id - [namedlink locale]" format - if (handler->GetSession()) - handler->PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), localeNames[locale], knownStr, valStr); - else - handler->PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), localeNames[locale], knownStr, valStr); + // send skill in "id - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_SKILL_LIST_CHAT, id, id, name.c_str(), "", knownStr, valStr); + else + handler->PSendSysMessage(LANG_SKILL_LIST_CONSOLE, id, name.c_str(), "", knownStr, valStr); - if (!found) - found = true; - } + if (!found) + found = true; } } if (!found) @@ -867,83 +794,63 @@ public: SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); if (spellInfo) { - int locale = handler->GetSessionDbcLocale(); - std::string name = spellInfo->SpellName[locale]; + std::string name = spellInfo->SpellName; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) + continue; + + if (maxResults && count++ == maxResults) { - locale = 0; - for (; locale < TOTAL_LOCALES; ++locale) - { - if (locale == handler->GetSessionDbcLocale()) - continue; + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - name = spellInfo->SpellName[locale]; - if (name.empty()) - continue; + bool known = target && target->HasSpell(id); + bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); - if (Utf8FitTo(name, wNamePart)) - break; - } - } + SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell); - if (locale < TOTAL_LOCALES) - { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + uint32 talentCost = GetTalentSpellCost(id); - bool known = target && target->HasSpell(id); - bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); + bool talent = (talentCost > 0); + bool passive = spellInfo->IsPassive(); + bool active = target && target->HasAura(id); - SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell); + // unit32 used to prevent interpreting uint8 as char at output + // find rank of learned spell for learning spell, or talent rank + uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank(); - uint32 talentCost = GetTalentSpellCost(id); + // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format + std::ostringstream ss; + if (handler->GetSession()) + ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name; + else + ss << id << " - " << name; - bool talent = (talentCost > 0); - bool passive = spellInfo->IsPassive(); - bool active = target && target->HasAura(id); + // include rank in link name + if (rank) + ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank; - // unit32 used to prevent interpreting uint8 as char at output - // find rank of learned spell for learning spell, or talent rank - uint32 rank = talentCost ? talentCost : learn && learnSpellInfo ? learnSpellInfo->GetRank() : spellInfo->GetRank(); + if (handler->GetSession()) + ss << "]|h|r"; - // send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format - std::ostringstream ss; - if (handler->GetSession()) - ss << id << " - |cffffffff|Hspell:" << id << "|h[" << name; - else - ss << id << " - " << name; - - // include rank in link name - if (rank) - ss << handler->GetTrinityString(LANG_SPELL_RANK) << rank; - - if (handler->GetSession()) - ss << ' ' << localeNames[locale] << "]|h|r"; - else - ss << ' ' << localeNames[locale]; - - if (talent) - ss << handler->GetTrinityString(LANG_TALENT); - if (passive) - ss << handler->GetTrinityString(LANG_PASSIVE); - if (learn) - ss << handler->GetTrinityString(LANG_LEARN); - if (known) - ss << handler->GetTrinityString(LANG_KNOWN); - if (active) - ss << handler->GetTrinityString(LANG_ACTIVE); + if (talent) + ss << handler->GetTrinityString(LANG_TALENT); + if (passive) + ss << handler->GetTrinityString(LANG_PASSIVE); + if (learn) + ss << handler->GetTrinityString(LANG_LEARN); + if (known) + ss << handler->GetTrinityString(LANG_KNOWN); + if (active) + ss << handler->GetTrinityString(LANG_ACTIVE); - handler->SendSysMessage(ss.str().c_str()); + handler->SendSysMessage(ss.str().c_str()); - if (!found) - found = true; - } + if (!found) + found = true; } } if (!found) @@ -970,7 +877,7 @@ public: if (spellInfo) { int locale = handler->GetSessionDbcLocale(); - std::string name = spellInfo->SpellName[locale]; + std::string name = spellInfo->SpellName; if (name.empty()) { handler->SendSysMessage(LANG_COMMAND_NOSPELLFOUND); @@ -1064,47 +971,29 @@ public: TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id); if (nodeEntry) { - int locale = handler->GetSessionDbcLocale(); - std::string name = nodeEntry->name[locale]; + std::string name = nodeEntry->name; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - { - locale = 0; - for (; locale < TOTAL_LOCALES; ++locale) - { - if (locale == handler->GetSessionDbcLocale()) - continue; - - name = nodeEntry->name[locale]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wNamePart)) - break; - } - } + continue; - if (locale < TOTAL_LOCALES) + if (maxResults && count++ == maxResults) { - if (maxResults && count++ == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format - if (handler->GetSession()) - handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), localeNames[locale], - nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); - else - handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), localeNames[locale], - nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); + // send taxinode in "id - [name] (Map:m X:x Y:y Z:z)" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CHAT, id, id, name.c_str(), "", + nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); + else + handler->PSendSysMessage(LANG_TAXINODE_ENTRY_LIST_CONSOLE, id, name.c_str(), "", + nodeEntry->map_id, nodeEntry->x, nodeEntry->y, nodeEntry->z); - if (!found) - found = true; - } + if (!found) + found = true; } } if (!found) @@ -1201,53 +1090,35 @@ public: CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); if (titleInfo) { - int locale = handler->GetSessionDbcLocale(); - std::string name = titleInfo->name[locale]; + std::string name = titleInfo->name; if (name.empty()) continue; if (!Utf8FitTo(name, wNamePart)) - { - locale = 0; - for (; locale < TOTAL_LOCALES; ++locale) - { - if (locale == handler->GetSessionDbcLocale()) - continue; - - name = titleInfo->name[locale]; - if (name.empty()) - continue; - - if (Utf8FitTo(name, wNamePart)) - break; - } - } + continue; - if (locale < TOTAL_LOCALES) + if (maxResults && counter == maxResults) { - if (maxResults && counter == maxResults) - { - handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); - return true; - } + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } - char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : ""; + char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetTrinityString(LANG_KNOWN) : ""; - char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index - ? handler->GetTrinityString(LANG_ACTIVE) - : ""; + char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index + ? handler->GetTrinityString(LANG_ACTIVE) + : ""; - char titleNameStr[80]; - snprintf(titleNameStr, 80, name.c_str(), targetName); + char titleNameStr[80]; + snprintf(titleNameStr, 80, name.c_str(), targetName); - // send title in "id (idx:idx) - [namedlink locale]" format - if (handler->GetSession()) - handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, localeNames[locale], knownStr, activeStr); - else - handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, localeNames[locale], knownStr, activeStr); + // send title in "id (idx:idx) - [namedlink locale]" format + if (handler->GetSession()) + handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, id, titleInfo->bit_index, id, titleNameStr, "", knownStr, activeStr); + else + handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, id, titleInfo->bit_index, titleNameStr, "", knownStr, activeStr); - ++counter; - } + ++counter; } } if (counter == 0) // if counter == 0 then we found nth @@ -1278,7 +1149,7 @@ public: { if (MapEntry const* mapInfo = sMapStore.LookupEntry(id)) { - std::string name = mapInfo->name[locale]; + std::string name = mapInfo->name; if (name.empty()) continue; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index c6d80cea3a5..8357b0ec090 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -111,7 +111,6 @@ public: { "cometome", SEC_ADMINISTRATOR, false, &HandleComeToMeCommand, "", NULL }, { "damage", SEC_ADMINISTRATOR, false, &HandleDamageCommand, "", NULL }, { "combatstop", SEC_GAMEMASTER, true, &HandleCombatStopCommand, "", NULL }, - { "flusharenapoints", SEC_ADMINISTRATOR, false, &HandleFlushArenaPointsCommand, "", NULL }, { "repairitems", SEC_GAMEMASTER, true, &HandleRepairitemsCommand, "", NULL }, { "freeze", SEC_MODERATOR, false, &HandleFreezeCommand, "", NULL }, { "unfreeze", SEC_MODERATOR, false, &HandleUnFreezeCommand, "", NULL }, @@ -228,9 +227,9 @@ public: handler->PSendSysMessage("no VMAP available for area info"); handler->PSendSysMessage(LANG_MAP_POSITION, - mapId, (mapEntry ? mapEntry->name[handler->GetSessionDbcLocale()] : "<unknown>"), - zoneId, (zoneEntry ? zoneEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"), - areaId, (areaEntry ? areaEntry->area_name[handler->GetSessionDbcLocale()] : "<unknown>"), + mapId, (mapEntry ? mapEntry->name : "<unknown>"), + zoneId, (zoneEntry ? zoneEntry->area_name : "<unknown>"), + areaId, (areaEntry ? areaEntry->area_name : "<unknown>"), object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation(), cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), object->GetInstanceId(), @@ -1462,7 +1461,7 @@ public: if (!target->GetSkillValue(skill)) { - handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name[handler->GetSessionDbcLocale()]); + handler->PSendSysMessage(LANG_SET_SKILL_ERROR, tNameLink.c_str(), skill, skillLine->name); handler->SetSentErrorMessage(true); return false; } @@ -1473,7 +1472,7 @@ public: return false; target->SetSkill(skill, target->GetSkillStep(skill), level, max); - handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name[handler->GetSessionDbcLocale()], tNameLink.c_str(), level, max); + handler->PSendSysMessage(LANG_SET_SKILL, skill, skillLine->name, tNameLink.c_str(), level, max); return true; } @@ -1672,6 +1671,12 @@ public: case RACE_DRAENEI: raceStr = "Draenei"; break; + case RACE_GOBLIN: + raceStr = "Goblin"; + break; + case RACE_WORGEN: + raceStr = "Worgen"; + break; } switch (Class) @@ -1715,7 +1720,6 @@ public: handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp); // Add map, zone, subzone and phase to output - int locale = handler->GetSessionDbcLocale(); std::string areaName = "<unknown>"; std::string zoneName = ""; @@ -1724,22 +1728,22 @@ public: AreaTableEntry const* area = GetAreaEntryByAreaID(areaId); if (area) { - areaName = area->area_name[locale]; + areaName = area->area_name; AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); if (zone) - zoneName = zone->area_name[locale]; + zoneName = zone->area_name; } if (target) { if (!zoneName.empty()) - handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase); + handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name, zoneName.c_str(), areaName.c_str(), phase); else - handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase); + handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name, areaName.c_str(), "<unknown>", phase); } else - handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); + handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name, areaName.c_str()); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED); stmt->setUInt32(0, GUID_LOPART(targetGuid)); @@ -2155,12 +2159,6 @@ public: return true; } - static bool HandleFlushArenaPointsCommand(ChatHandler* /*handler*/, char const* /*args*/) - { - sArenaTeamMgr->DistributeArenaPoints(); - return true; - } - static bool HandleRepairitemsCommand(ChatHandler* handler, char const* args) { Player* target; diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index 7219615736e..809b6e8db74 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -23,6 +23,7 @@ Category: commandscripts EndScriptData */ #include "Chat.h" +#include <stdlib.h> #include "ObjectMgr.h" #include "Opcodes.h" #include "Pet.h" @@ -64,11 +65,11 @@ public: { "mount", SEC_MODERATOR, false, &HandleModifyMountCommand, "", NULL }, { "honor", SEC_MODERATOR, false, &HandleModifyHonorCommand, "", NULL }, { "reputation", SEC_GAMEMASTER, false, &HandleModifyRepCommand, "", NULL }, - { "arenapoints", SEC_MODERATOR, false, &HandleModifyArenaCommand, "", NULL }, { "drunk", SEC_MODERATOR, false, &HandleModifyDrunkCommand, "", NULL }, { "standstate", SEC_GAMEMASTER, false, &HandleModifyStandStateCommand, "", NULL }, { "phase", SEC_ADMINISTRATOR, false, &HandleModifyPhaseCommand, "", NULL }, { "gender", SEC_GAMEMASTER, false, &HandleModifyGenderCommand, "", NULL }, + { "currency", SEC_GAMEMASTER, false, &HandleModifyCurrencyCommand, "", NULL }, { "speed", SEC_MODERATOR, false, NULL, "", modifyspeedCommandTable }, { NULL, 0, false, NULL, "", NULL } }; @@ -973,14 +974,14 @@ public: target->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP); target->Mount(mId); - WorldPacket data(SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4)); + WorldPacket data(SMSG_MOVE_SET_RUN_SPEED, (8+4+1+4)); data.append(target->GetPackGUID()); data << (uint32)0; data << (uint8)0; //new 2.1.0 data << float(speed); target->SendMessageToSet(&data, true); - data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, (8+4+4)); + data.Initialize(SMSG_MOVE_SET_SWIM_SPEED, (8+4+4)); data.append(target->GetPackGUID()); data << (uint32)0; data << float(speed); @@ -1007,19 +1008,19 @@ public: if (handler->HasLowerSecurity(target, 0)) return false; - int32 moneyToAdd = 0; + int64 moneyToAdd = 0; if (strchr(args, 'g') || strchr(args, 's') || strchr(args, 'c')) moneyToAdd = MoneyStringToMoney(std::string(args)); else - moneyToAdd = atoi(args); + moneyToAdd = atol(args); - uint32 targetMoney = target->GetMoney(); + uint64 targetMoney = target->GetMoney(); if (moneyToAdd < 0) { - int32 newmoney = int32(targetMoney) + moneyToAdd; + int64 newmoney = int64(targetMoney) + moneyToAdd; - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_CURRENT_MONEY), uint32(targetMoney), int32(moneyToAdd), uint32(newmoney)); if (newmoney <= 0) { handler->PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, handler->GetNameLink(target).c_str()); @@ -1030,31 +1031,32 @@ public: } else { + uint32 moneyToAddMsg = moneyToAdd * -1; if (newmoney > MAX_MONEY_AMOUNT) newmoney = MAX_MONEY_AMOUNT; - handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(moneyToAdd), handler->GetNameLink(target).c_str()); + handler->PSendSysMessage(LANG_YOU_TAKE_MONEY, moneyToAddMsg, handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), abs(moneyToAdd)); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, handler->GetNameLink().c_str(), moneyToAddMsg); target->SetMoney(newmoney); } } else { - handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, moneyToAdd, handler->GetNameLink(target).c_str()); + handler->PSendSysMessage(LANG_YOU_GIVE_MONEY, uint32(moneyToAdd), handler->GetNameLink(target).c_str()); if (handler->needReportToTarget(target)) - ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), moneyToAdd); + ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), uint32(moneyToAdd)); if (moneyToAdd >= MAX_MONEY_AMOUNT) moneyToAdd = MAX_MONEY_AMOUNT; - if (targetMoney >= uint32(MAX_MONEY_AMOUNT) - moneyToAdd) + if (targetMoney >= uint64(MAX_MONEY_AMOUNT) - moneyToAdd) moneyToAdd -= targetMoney; target->ModifyMoney(moneyToAdd); } - sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney()); + sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), uint32(targetMoney), int32(moneyToAdd), uint32(target->GetMoney())); return true; } @@ -1114,7 +1116,7 @@ public: return true; } - static bool HandleModifyHonorCommand (ChatHandler* handler, const char* args) + static bool HandleModifyHonorCommand(ChatHandler* handler, const char* args) { if (!*args) return false; @@ -1133,9 +1135,9 @@ public: int32 amount = (uint32)atoi(args); - target->ModifyHonorPoints(amount); + target->ModifyCurrency(CURRENCY_TYPE_HONOR_POINTS, amount, true, true); - handler->PSendSysMessage(LANG_COMMAND_MODIFY_HONOR, handler->GetNameLink(target).c_str(), target->GetHonorPoints()); + handler->PSendSysMessage(LANG_COMMAND_MODIFY_HONOR, handler->GetNameLink(target).c_str(), target->GetCurrency(CURRENCY_TYPE_HONOR_POINTS, false)); return true; } @@ -1243,14 +1245,14 @@ public: if (factionEntry->reputationListID < 0) { - handler->PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->name[handler->GetSessionDbcLocale()], factionId); + handler->PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->name, factionId); handler->SetSentErrorMessage(true); return false; } target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false); target->GetReputationMgr().SendState(target->GetReputationMgr().GetState(factionEntry)); - handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[handler->GetSessionDbcLocale()], factionId, + handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name, factionId, handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry)); return true; } @@ -1285,14 +1287,15 @@ public: uint32 phasemask = (uint32)atoi((char*)args); Unit* target = handler->getSelectedUnit(); - if (!target) - target = handler->GetSession()->GetPlayer(); - - // check online security - else if (target->GetTypeId() == TYPEID_PLAYER && handler->HasLowerSecurity(target->ToPlayer(), 0)) - return false; - - target->SetPhaseMask(phasemask, true); + if (target) + { + if (target->GetTypeId() == TYPEID_PLAYER) + target->ToPlayer()->GetPhaseMgr().SetCustomPhase(phasemask); + else + target->SetPhaseMask(phasemask, true); + } + else + handler->GetSession()->GetPlayer()->GetPhaseMgr().SetCustomPhase(phasemask); return true; } @@ -1309,28 +1312,6 @@ public: return true; } - static bool HandleModifyArenaCommand(ChatHandler* handler, const char* args) - { - if (!*args) - return false; - - Player* target = handler->getSelectedPlayer(); - if (!target) - { - handler->SendSysMessage(LANG_PLAYER_NOT_FOUND); - handler->SetSentErrorMessage(true); - return false; - } - - int32 amount = (uint32)atoi(args); - - target->ModifyArenaPoints(amount); - - handler->PSendSysMessage(LANG_COMMAND_MODIFY_ARENA, handler->GetNameLink(target).c_str(), target->GetArenaPoints()); - - return true; - } - static bool HandleModifyGenderCommand(ChatHandler* handler, const char* args) { if (!*args) @@ -1406,6 +1387,33 @@ public: return true; } + + static bool HandleModifyCurrencyCommand(ChatHandler* handler, const char* args) + { + if (!*args) + return false; + + Player* target = handler->getSelectedPlayer(); + if (!target) + { + handler->PSendSysMessage(LANG_PLAYER_NOT_FOUND); + handler->SetSentErrorMessage(true); + return false; + } + + uint32 currencyId = atoi(strtok((char*)args, " ")); + const CurrencyTypesEntry* currencyType = sCurrencyTypesStore.LookupEntry(currencyId); + if (!currencyType) + return false; + + uint32 amount = atoi(strtok(NULL, " ")); + if (!amount) + return false; + + target->ModifyCurrency(currencyId, amount, true, true); + + return true; + } }; void AddSC_modify_commandscript() diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 79a74b0823d..e60fd36a375 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -191,13 +191,13 @@ public: } Creature* creature = new Creature(); - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), id, 0, (uint32)teamval, x, y, z, o)) { delete creature; return false; } - creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn()); uint32 db_guid = creature->GetDBTableGUIDLow(); @@ -218,6 +218,8 @@ public: if (!*args) return false; + const uint8 type = 1; // FIXME: make type (1 item, 2 currency) an argument + char* pitem = handler->extractKeyFromLink((char*)args, "Hitem"); if (!pitem) { @@ -254,13 +256,13 @@ public: uint32 vendor_entry = vendor ? vendor->GetEntry() : 0; - if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer())) + if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, type, handler->GetSession()->GetPlayer())) { handler->SetSentErrorMessage(true); return false; } - sObjectMgr->AddVendorItem(vendor_entry, itemId, maxcount, incrtime, extendedcost); + sObjectMgr->AddVendorItem(vendor_entry, itemId, maxcount, incrtime, extendedcost, type); ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); @@ -475,7 +477,9 @@ public: } uint32 itemId = atol(pitem); - if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), itemId)) + const uint8 type = 1; // FIXME: make type (1 item, 2 currency) an argument + + if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), itemId, type)) { handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId); handler->SetSentErrorMessage(true); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 7aee1139868..cd01711980e 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -26,7 +26,6 @@ EndScriptData */ #include "AchievementMgr.h" #include "AuctionHouseMgr.h" #include "Chat.h" -#include "CreatureEventAIMgr.h" #include "CreatureTextMgr.h" #include "DisableMgr.h" #include "Language.h" @@ -53,7 +52,6 @@ public: { { "achievement", SEC_ADMINISTRATOR, true, &HandleReloadAllAchievementCommand, "", NULL }, { "area", SEC_ADMINISTRATOR, true, &HandleReloadAllAreaCommand, "", NULL }, - { "eventai", SEC_ADMINISTRATOR, true, &HandleReloadAllEventAICommand, "", NULL }, { "gossips", SEC_ADMINISTRATOR, true, &HandleReloadAllGossipsCommand, "", NULL }, { "item", SEC_ADMINISTRATOR, true, &HandleReloadAllItemCommand, "", NULL }, { "locales", SEC_ADMINISTRATOR, true, &HandleReloadAllLocalesCommand, "", NULL }, @@ -80,8 +78,6 @@ public: { "conditions", SEC_ADMINISTRATOR, true, &HandleReloadConditions, "", NULL }, { "config", SEC_ADMINISTRATOR, true, &HandleReloadConfigCommand, "", NULL }, { "creature_text", SEC_ADMINISTRATOR, true, &HandleReloadCreatureText, "", NULL }, - { "creature_ai_scripts", SEC_ADMINISTRATOR, true, &HandleReloadEventAIScriptsCommand, "", NULL }, - { "creature_ai_texts", SEC_ADMINISTRATOR, true, &HandleReloadEventAITextsCommand, "", NULL }, { "creature_involvedrelation", SEC_ADMINISTRATOR, true, &HandleReloadCreatureQuestInvRelationsCommand, "", NULL }, { "creature_linked_respawn", SEC_GAMEMASTER, true, &HandleReloadLinkedRespawnCommand, "", NULL }, { "creature_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesCreatureCommand, "", NULL }, @@ -104,7 +100,6 @@ public: { "gossip_menu_option", SEC_ADMINISTRATOR, true, &HandleReloadGossipMenuOptionCommand, "", NULL }, { "item_enchantment_template", SEC_ADMINISTRATOR, true, &HandleReloadItemEnchantementsCommand, "", NULL }, { "item_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesItemCommand, "", NULL }, - { "item_set_names", SEC_ADMINISTRATOR, true, &HandleReloadItemSetNamesCommand, "", NULL }, { "lfg_dungeon_rewards", SEC_ADMINISTRATOR, true, &HandleReloadLfgRewardsCommand, "", NULL }, { "locales_achievement_reward", SEC_ADMINISTRATOR, true, &HandleReloadLocalesAchievementRewardCommand, "", NULL }, { "locales_creature", SEC_ADMINISTRATOR, true, &HandleReloadLocalesCreatureCommand, "", NULL }, @@ -112,7 +107,6 @@ public: { "locales_gameobject", SEC_ADMINISTRATOR, true, &HandleReloadLocalesGameobjectCommand, "", NULL }, { "locales_gossip_menu_option", SEC_ADMINISTRATOR, true, &HandleReloadLocalesGossipMenuOptionCommand, "", NULL }, { "locales_item", SEC_ADMINISTRATOR, true, &HandleReloadLocalesItemCommand, "", NULL }, - { "locales_item_set_name", SEC_ADMINISTRATOR, true, &HandleReloadLocalesItemSetNameCommand, "", NULL }, { "locales_npc_text", SEC_ADMINISTRATOR, true, &HandleReloadLocalesNpcTextCommand, "", NULL }, { "locales_page_text", SEC_ADMINISTRATOR, true, &HandleReloadLocalesPageTextCommand, "", NULL }, { "locales_points_of_interest", SEC_ADMINISTRATOR, true, &HandleReloadLocalesPointsOfInterestCommand, "", NULL }, @@ -124,6 +118,7 @@ public: { "npc_trainer", SEC_ADMINISTRATOR, true, &HandleReloadNpcTrainerCommand, "", NULL }, { "npc_vendor", SEC_ADMINISTRATOR, true, &HandleReloadNpcVendorCommand, "", NULL }, { "page_text", SEC_ADMINISTRATOR, true, &HandleReloadPageTextsCommand, "", NULL }, + { "phasedefinitions", SEC_ADMINISTRATOR, true, &HandleReloadPhaseDefinitionsCommand, "", NULL }, { "pickpocketing_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesPickpocketingCommand, "", NULL}, { "points_of_interest", SEC_ADMINISTRATOR, true, &HandleReloadPointsOfInterestCommand, "", NULL }, { "prospecting_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesProspectingCommand, "", NULL }, @@ -182,7 +177,6 @@ public: HandleReloadAllAchievementCommand(handler, ""); HandleReloadAllAreaCommand(handler, ""); - HandleReloadAllEventAICommand(handler, ""); HandleReloadAllLootCommand(handler, ""); HandleReloadAllNpcCommand(handler, ""); HandleReloadAllQuestCommand(handler, ""); @@ -273,13 +267,6 @@ public: return true; } - static bool HandleReloadAllEventAICommand(ChatHandler* handler, const char* /*args*/) - { - HandleReloadEventAITextsCommand(handler, "a"); - HandleReloadEventAIScriptsCommand(handler, "a"); - return true; - } - static bool HandleReloadAllSpellCommand(ChatHandler* handler, const char* /*args*/) { HandleReloadSkillDiscoveryTemplateCommand(handler, "a"); @@ -442,11 +429,12 @@ public: Field* fields = result->Fetch(); - cInfo->DifficultyEntry[0] = fields[0].GetUInt32(); - cInfo->DifficultyEntry[1] = fields[1].GetUInt32(); - cInfo->DifficultyEntry[2] = fields[2].GetUInt32(); - cInfo->KillCredit[0] = fields[3].GetUInt32(); - cInfo->KillCredit[1] = fields[4].GetUInt32(); + for (uint8 i = 0; i < MAX_DIFFICULTY - 1; ++i) + cInfo->DifficultyEntry[i] = fields[0 + i].GetUInt32(); + + for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i) + cInfo->KillCredit[i] = fields[3 + i].GetUInt32(); + cInfo->Modelid1 = fields[5].GetUInt32(); cInfo->Modelid2 = fields[6].GetUInt32(); cInfo->Modelid3 = fields[7].GetUInt32(); @@ -458,27 +446,27 @@ public: cInfo->minlevel = fields[13].GetUInt8(); cInfo->maxlevel = fields[14].GetUInt8(); cInfo->expansion = fields[15].GetUInt16(); - cInfo->faction_A = fields[16].GetUInt16(); - cInfo->faction_H = fields[17].GetUInt16(); - cInfo->npcflag = fields[18].GetUInt32(); - cInfo->speed_walk = fields[19].GetFloat(); - cInfo->speed_run = fields[20].GetFloat(); - cInfo->scale = fields[21].GetFloat(); - cInfo->rank = fields[22].GetUInt8(); - cInfo->mindmg = fields[23].GetFloat(); - cInfo->maxdmg = fields[24].GetFloat(); - cInfo->dmgschool = fields[25].GetUInt8(); - cInfo->attackpower = fields[26].GetUInt32(); - cInfo->dmg_multiplier = fields[27].GetFloat(); - cInfo->baseattacktime = fields[28].GetUInt32(); - cInfo->rangeattacktime = fields[29].GetUInt32(); - cInfo->unit_class = fields[30].GetUInt8(); - cInfo->unit_flags = fields[31].GetUInt32(); - cInfo->unit_flags2 = fields[32].GetUInt32(); - cInfo->dynamicflags = fields[33].GetUInt32(); - cInfo->family = fields[34].GetUInt8(); - cInfo->trainer_type = fields[35].GetUInt8(); - cInfo->trainer_spell = fields[36].GetUInt32(); + cInfo->expansionUnknown = fields[16].GetUInt16(); + cInfo->faction_A = fields[17].GetUInt16(); + cInfo->faction_H = fields[18].GetUInt16(); + cInfo->npcflag = fields[19].GetUInt32(); + cInfo->speed_walk = fields[20].GetFloat(); + cInfo->speed_run = fields[21].GetFloat(); + cInfo->scale = fields[22].GetFloat(); + cInfo->rank = fields[23].GetUInt8(); + cInfo->mindmg = fields[24].GetFloat(); + cInfo->maxdmg = fields[25].GetFloat(); + cInfo->dmgschool = fields[26].GetUInt8(); + cInfo->attackpower = fields[27].GetUInt32(); + cInfo->dmg_multiplier = fields[28].GetFloat(); + cInfo->baseattacktime = fields[29].GetUInt32(); + cInfo->rangeattacktime = fields[30].GetUInt32(); + cInfo->unit_class = fields[31].GetUInt8(); + cInfo->unit_flags = fields[32].GetUInt32(); + cInfo->unit_flags2 = fields[33].GetUInt32(); + cInfo->dynamicflags = fields[34].GetUInt32(); + cInfo->family = fields[35].GetUInt8(); + cInfo->trainer_type = fields[36].GetUInt8(); cInfo->trainer_class = fields[37].GetUInt8(); cInfo->trainer_race = fields[38].GetUInt8(); cInfo->minrangedmg = fields[39].GetFloat(); @@ -486,44 +474,39 @@ public: cInfo->rangedattackpower = fields[41].GetUInt16(); cInfo->type = fields[42].GetUInt8(); cInfo->type_flags = fields[43].GetUInt32(); - cInfo->lootid = fields[44].GetUInt32(); - cInfo->pickpocketLootId = fields[45].GetUInt32(); - cInfo->SkinLootId = fields[46].GetUInt32(); + cInfo->type_flags2 = fields[44].GetUInt32(); + cInfo->lootid = fields[45].GetUInt32(); + cInfo->pickpocketLootId = fields[46].GetUInt32(); + cInfo->SkinLootId = fields[47].GetUInt32(); for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - cInfo->resistance[i] = fields[47 + i -1].GetUInt16(); - - cInfo->spells[0] = fields[53].GetUInt32(); - cInfo->spells[1] = fields[54].GetUInt32(); - cInfo->spells[2] = fields[55].GetUInt32(); - cInfo->spells[3] = fields[56].GetUInt32(); - cInfo->spells[4] = fields[57].GetUInt32(); - cInfo->spells[5] = fields[58].GetUInt32(); - cInfo->spells[6] = fields[59].GetUInt32(); - cInfo->spells[7] = fields[60].GetUInt32(); - cInfo->PetSpellDataId = fields[61].GetUInt32(); - cInfo->VehicleId = fields[62].GetUInt32(); - cInfo->mingold = fields[63].GetUInt32(); - cInfo->maxgold = fields[64].GetUInt32(); - cInfo->AIName = fields[65].GetString(); - cInfo->MovementType = fields[66].GetUInt8(); - cInfo->InhabitType = fields[67].GetUInt8(); - cInfo->HoverHeight = fields[68].GetFloat(); - cInfo->ModHealth = fields[69].GetFloat(); - cInfo->ModMana = fields[70].GetFloat(); - cInfo->ModArmor = fields[71].GetFloat(); - cInfo->RacialLeader = fields[72].GetBool(); - cInfo->questItems[0] = fields[73].GetUInt32(); - cInfo->questItems[1] = fields[74].GetUInt32(); - cInfo->questItems[2] = fields[75].GetUInt32(); - cInfo->questItems[3] = fields[76].GetUInt32(); - cInfo->questItems[4] = fields[77].GetUInt32(); - cInfo->questItems[5] = fields[78].GetUInt32(); - cInfo->movementId = fields[79].GetUInt32(); - cInfo->RegenHealth = fields[80].GetBool(); - cInfo->MechanicImmuneMask = fields[81].GetUInt32(); - cInfo->flags_extra = fields[82].GetUInt32(); - cInfo->ScriptID = sObjectMgr->GetScriptId(fields[83].GetCString()); + cInfo->resistance[i] = fields[48 + i -1].GetUInt16(); + + for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) + cInfo->spells[i] = fields[54 + i].GetUInt32(); + + cInfo->PetSpellDataId = fields[62].GetUInt32(); + cInfo->VehicleId = fields[63].GetUInt32(); + cInfo->mingold = fields[64].GetUInt32(); + cInfo->maxgold = fields[65].GetUInt32(); + cInfo->AIName = fields[66].GetString(); + cInfo->MovementType = fields[67].GetUInt8(); + cInfo->InhabitType = fields[68].GetUInt8(); + cInfo->HoverHeight = fields[69].GetFloat(); + cInfo->ModHealth = fields[70].GetFloat(); + cInfo->ModMana = fields[71].GetFloat(); + cInfo->ModManaExtra = fields[72].GetFloat(); + cInfo->ModArmor = fields[73].GetFloat(); + cInfo->RacialLeader = fields[74].GetBool(); + + for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i) + cInfo->questItems[i] = fields[75 + i].GetUInt32(); + + cInfo->movementId = fields[81].GetUInt32(); + cInfo->RegenHealth = fields[82].GetBool(); + cInfo->MechanicImmuneMask = fields[83].GetUInt32(); + cInfo->flags_extra = fields[84].GetUInt32(); + cInfo->ScriptID = sObjectMgr->GetScriptId(fields[85].GetCString()); sObjectMgr->CheckCreatureTemplate(cInfo); } @@ -953,14 +936,6 @@ public: return true; } - static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/) - { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Item set names..."); - sObjectMgr->LoadItemSetNames(); - handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded."); - return true; - } - static bool HandleReloadEventScriptsCommand(ChatHandler* handler, const char* args) { if (sScriptMgr->IsScriptScheduled()) @@ -1014,23 +989,6 @@ public: return true; } - static bool HandleReloadEventAITextsCommand(ChatHandler* handler, const char* /*args*/) - { - - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Texts from `creature_ai_texts`..."); - sEventAIMgr->LoadCreatureEventAI_Texts(); - handler->SendGlobalGMSysMessage("DB table `creature_ai_texts` reloaded."); - return true; - } - - static bool HandleReloadEventAIScriptsCommand(ChatHandler* handler, const char* /*args*/) - { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Scripts from `creature_ai_scripts`..."); - sEventAIMgr->LoadCreatureEventAI_Scripts(); - handler->SendGlobalGMSysMessage("DB table `creature_ai_scripts` reloaded."); - return true; - } - static bool HandleReloadSpellScriptsCommand(ChatHandler* handler, const char* args) { if (sScriptMgr->IsScriptScheduled()) @@ -1147,14 +1105,6 @@ public: return true; } - static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/) - { - sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales Item set name... "); - sObjectMgr->LoadItemSetNameLocales(); - handler->SendGlobalGMSysMessage("DB table `locales_item_set_name` reloaded."); - return true; - } - static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/) { sLog->outInfo(LOG_FILTER_GENERAL, "Re-Loading Locales NPC Text ... "); @@ -1245,6 +1195,16 @@ public: return true; } + + static bool HandleReloadPhaseDefinitionsCommand(ChatHandler* handler, const char* /*args*/) + { + sLog->outInfo(LOG_FILTER_GENERAL, "Reloading phase_definitions table..."); + sObjectMgr->LoadPhaseDefinitions(); + sWorld->UpdatePhaseDefinitions(); + handler->SendGlobalGMSysMessage("Phase Definitions reloaded."); + return true; + } + static bool HandleReloadRBACCommand(ChatHandler* handler, const char* /*args*/) { sLog->outInfo(LOG_FILTER_GENERAL, "Reloading RBAC tables..."); diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 44d97ee2221..355053905f1 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -66,7 +66,7 @@ public: if (target) target->ResetAchievements(); else - AchievementMgr::DeleteFromDB(GUID_LOPART(targetGuid)); + AchievementMgr<Player>::DeleteFromDB(GUID_LOPART(targetGuid)); return true; } @@ -77,11 +77,8 @@ public: if (!handler->extractPlayerTarget((char*)args, &target)) return false; - target->SetHonorPoints(0); target->SetUInt32Value(PLAYER_FIELD_KILLS, 0); target->SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, 0); - target->SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0); - target->SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0); target->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL); return true; @@ -238,7 +235,7 @@ public: if (target) { - target->resetTalents(true); + target->ResetTalents(true); target->SendTalentsInfoData(false); ChatHandler(target->GetSession()).SendSysMessage(LANG_RESET_TALENTS); if (!handler->GetSession() || handler->GetSession()->GetPlayer() != target) diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp index 4c80f669312..bad3b8c0318 100644 --- a/src/server/scripts/Commands/cs_titles.cpp +++ b/src/server/scripts/Commands/cs_titles.cpp @@ -96,7 +96,7 @@ public: target->SetTitle(titleInfo); // to be sure that title now known target->SetUInt32Value(PLAYER_CHOSEN_TITLE, titleInfo->bit_index); - handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id, titleInfo->name[handler->GetSessionDbcLocale()], tNameLink.c_str()); + handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, id, titleInfo->name, tNameLink.c_str()); return true; } @@ -139,7 +139,7 @@ public: std::string tNameLink = handler->GetNameLink(target); char titleNameStr[80]; - snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], target->GetName().c_str()); + snprintf(titleNameStr, 80, titleInfo->name, target->GetName().c_str()); target->SetTitle(titleInfo); handler->PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str()); @@ -187,7 +187,7 @@ public: std::string tNameLink = handler->GetNameLink(target); char titleNameStr[80]; - snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], target->GetName().c_str()); + snprintf(titleNameStr, 80, titleInfo->name, target->GetName().c_str()); handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str()); diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index bb48e94f744..b162e0c51a4 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -241,40 +241,44 @@ public: if (!target) { - handler->PSendSysMessage("%s%s|r", "|cff33ffff", "You must select target."); + handler->PSendSysMessage("%s%s|r", "|cff33ffff", "You must select a target."); return true; } - uint32 guildLow = target->GetDBTableGUIDLow(); + uint32 guidLow = target->GetDBTableGUIDLow(); + if (guidLow == 0) + { + handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target is not saved to DB."); + return true; + } - if (target->GetCreatureAddon()) + CreatureAddon const* addon = sObjectMgr->GetCreatureAddon(guidLow); + if (!addon || addon->path_id == 0) { - if (target->GetCreatureAddon()->path_id != 0) - { - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON); + handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target does not have a loaded path."); + return true; + } - stmt->setUInt32(0, guildLow); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON); - WorldDatabase.Execute(stmt); + stmt->setUInt32(0, guidLow); + + WorldDatabase.Execute(stmt); - target->UpdateWaypointID(0); + target->UpdateWaypointID(0); - stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE); + stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE); - stmt->setUInt8(0, uint8(IDLE_MOTION_TYPE)); - stmt->setUInt32(1, guildLow); + stmt->setUInt8(0, uint8(IDLE_MOTION_TYPE)); + stmt->setUInt32(1, guidLow); - WorldDatabase.Execute(stmt); + WorldDatabase.Execute(stmt); - target->LoadPath(0); - target->SetDefaultMovementType(IDLE_MOTION_TYPE); - target->GetMotionMaster()->MoveTargetedHome(); - target->GetMotionMaster()->Initialize(); - target->MonsterSay("Path unloaded.", 0, 0); - return true; - } - handler->PSendSysMessage("%s%s|r", "|cffff33ff", "Target have no loaded path."); - } + target->LoadPath(0); + target->SetDefaultMovementType(IDLE_MOTION_TYPE); + target->GetMotionMaster()->MoveTargetedHome(); + target->GetMotionMaster()->Initialize(); + target->MonsterSay("Path unloaded.", 0, 0); return true; } @@ -690,7 +694,7 @@ public: } // re-create Creature* wpCreature2 = new Creature; - if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) + if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, 0, 0, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); delete wpCreature2; @@ -698,7 +702,7 @@ public: return false; } - wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn()); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); /// @todo Should we first use "Create" then use "LoadFromDB"? if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetDBTableGUIDLow(), map)) @@ -914,7 +918,7 @@ public: float o = chr->GetOrientation(); Creature* wpCreature = new Creature; - if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) + if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete wpCreature; @@ -930,7 +934,7 @@ public: WorldDatabase.Execute(stmt); - wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn()); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); if (!wpCreature->LoadCreatureFromDB(wpCreature->GetDBTableGUIDLow(), map)) { @@ -978,14 +982,14 @@ public: Map* map = chr->GetMap(); Creature* creature = new Creature; - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete creature; return false; } - creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn()); if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); @@ -1027,14 +1031,14 @@ public: Map* map = chr->GetMap(); Creature* creature = new Creature; - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); delete creature; return false; } - creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); + creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn()); if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map)) { handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); |
