aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
authorVincent_Michael <Vincent_Michael@gmx.de>2013-03-10 01:08:55 +0100
committerVincent_Michael <Vincent_Michael@gmx.de>2013-03-10 01:08:55 +0100
commita9b740ab747332dde2967426027c43f98efbebac (patch)
tree04f3999dd51a9eb2d7811f751dad124242390fb8 /src/server/scripts/Commands
parent83a5043741c0ef3d96ff59571305eae30d360ed5 (diff)
parentf3617abdba8c247d4e9f423e5e97e3b42dab7b41 (diff)
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/AI/EventAI/CreatureEventAI.cpp src/server/game/AI/EventAI/CreatureEventAIMgr.h src/server/game/Entities/Creature/Creature.cpp src/server/game/Entities/Object/Object.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.h src/server/game/Guilds/Guild.cpp src/server/game/Handlers/MailHandler.cpp src/server/game/Spells/Auras/SpellAuraEffects.cpp src/server/game/Spells/Auras/SpellAuras.cpp src/server/game/Spells/SpellEffects.cpp src/server/scripts/Commands/cs_misc.cpp src/server/scripts/Commands/cs_modify.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp src/server/scripts/Kalimdor/zone_azshara.cpp src/server/scripts/Kalimdor/zone_darkshore.cpp src/server/scripts/Kalimdor/zone_durotar.cpp src/server/scripts/Kalimdor/zone_orgrimmar.cpp src/server/scripts/Spells/spell_mage.cpp src/server/shared/Packets/ByteBuffer.h
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/CMakeLists.txt1
-rw-r--r--src/server/scripts/Commands/cs_account.cpp2
-rw-r--r--src/server/scripts/Commands/cs_character.cpp4
-rw-r--r--src/server/scripts/Commands/cs_deserter.cpp199
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp2
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp15
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp1
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp8
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp2
9 files changed, 219 insertions, 15 deletions
diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt
index 83e97b2c80d..15e16c2caf1 100644
--- a/src/server/scripts/Commands/CMakeLists.txt
+++ b/src/server/scripts/Commands/CMakeLists.txt
@@ -18,6 +18,7 @@ set(scripts_STAT_SRCS
Commands/cs_character.cpp
Commands/cs_cheat.cpp
Commands/cs_debug.cpp
+ Commands/cs_deserter.cpp
Commands/cs_disable.cpp
Commands/cs_event.cpp
Commands/cs_gm.cpp
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 4dc44bbfc58..3953beab3da 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -140,7 +140,7 @@ public:
}
/// Delete a user account and all associated characters in this realm
- /// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm then delete account)
+ /// @todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm then delete account)
static bool HandleAccountDeleteCommand(ChatHandler* handler, char const* args)
{
if (!*args)
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index 2ab3793f881..1ed00f32b87 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -443,7 +443,7 @@ public:
stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE));
if (target)
{
- // TODO : add text into database
+ /// @todo add text into database
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());
target->SetAtLoginFlag(AT_LOGIN_CHANGE_RACE);
stmt->setUInt32(1, target->GetGUIDLow());
@@ -451,7 +451,7 @@ public:
else
{
std::string oldNameLink = handler->playerLink(targetName);
- // TODO : add text into database
+ /// @todo add text into database
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
stmt->setUInt32(1, GUID_LOPART(targetGuid));
}
diff --git a/src/server/scripts/Commands/cs_deserter.cpp b/src/server/scripts/Commands/cs_deserter.cpp
new file mode 100644
index 00000000000..3850456fcb3
--- /dev/null
+++ b/src/server/scripts/Commands/cs_deserter.cpp
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+* @file cs_deserter.cpp
+* @brief .deserter related commands
+*
+* This file contains the CommandScripts for all deserter sub-commands
+*/
+
+#include "Chat.h"
+#include "Player.h"
+#include "Language.h"
+#include "ScriptMgr.h"
+#include "SpellAuras.h"
+
+enum Spells
+{
+ LFG_SPELL_DUNGEON_DESERTER = 71041,
+ BG_SPELL_DESERTER = 26013
+};
+
+class deserter_commandscript : public CommandScript
+{
+public:
+ deserter_commandscript() : CommandScript("deserter_commandscript") { }
+
+ /**
+ * @brief Returns the command structure for the system.
+ */
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand deserterInstanceCommandTable[] =
+ {
+ { "add", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceAdd, "", NULL },
+ { "remove", SEC_ADMINISTRATOR, false, &HandleDeserterInstanceRemove, "", NULL },
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
+ };
+ static ChatCommand deserterBGCommandTable[] =
+ {
+ { "add", SEC_ADMINISTRATOR, false, &HandleDeserterBGAdd, "", NULL },
+ { "remove", SEC_ADMINISTRATOR, false, &HandleDeserterBGRemove, "", NULL },
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
+ };
+
+ static ChatCommand deserterCommandTable[] =
+ {
+ { "instance", SEC_ADMINISTRATOR, false, NULL, "", deserterInstanceCommandTable },
+ { "bg", SEC_ADMINISTRATOR, false, NULL, "", deserterBGCommandTable },
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
+ };
+ static ChatCommand commandTable[] =
+ {
+ { "deserter", SEC_ADMINISTRATOR, false, NULL, "", deserterCommandTable },
+ { NULL, SEC_PLAYER, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ /**
+ * @brief Applies the Deserter Debuff to a player
+ *
+ * This function applies a Deserter Debuff of the given type (Instance or BG) to the
+ * selected player, with the provided duration in seconds.
+ *
+ * @param handler The ChatHandler, passed by the system.
+ * @param args The provided duration in seconds.
+ * @param isInstance provided by the relaying functions, so we don't have
+ * to write that much code :)
+ *
+ * @return true if everything was correct, false if an error occured.
+ *
+ * Example Usage:
+ * @code
+ * .deserter instance add 3600 (one hour)
+ * -or-
+ * .deserter bg add 3600 (one hour)
+ * @endcode
+ */
+ static bool HandleDeserterAdd(ChatHandler* handler, char const* args, bool isInstance)
+ {
+ if (!*args)
+ return false;
+
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ char* timeStr = strtok((char*)args, " ");
+ if (!timeStr)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ uint32 time = atoi(timeStr);
+
+ if (!time)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ Aura* aura = player->AddAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER, player);
+
+ if (!aura)
+ {
+ handler->SendSysMessage(LANG_BAD_VALUE);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+ aura->SetDuration(time * IN_MILLISECONDS);
+
+ return true;
+ }
+
+ /**
+ * @brief Removes the Deserter Debuff from a player
+ *
+ * This function removes a Deserter Debuff of the given type (Instance or BG) from the
+ * selected player.
+ *
+ * @param handler The ChatHandler, passed by the system.
+ * @param args Should be nothing.
+ * @param isInstance provided by the relaying functions, so we don't have
+ * to write that much code :)
+ *
+ * @return true if everything was correct, false if an error occured.
+ *
+ * Example Usage:
+ * @code
+ * .deserter instance remove
+ * -or-
+ * .deserter bg remove
+ * @endcode
+ */
+ static bool HandleDeserterRemove(ChatHandler* handler, char const* /*args*/, bool isInstance)
+ {
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ {
+ handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ player->RemoveAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER);
+
+ return true;
+ }
+
+ /// @sa HandleDeserterAdd()
+ static bool HandleDeserterInstanceAdd(ChatHandler* handler, char const* args)
+ {
+ return HandleDeserterAdd(handler, args, true);
+ }
+
+ /// @sa HandleDeserterAdd()
+ static bool HandleDeserterBGAdd(ChatHandler* handler, char const* args)
+ {
+ return HandleDeserterAdd(handler, args, false);
+ }
+
+ /// @sa HandleDeserterRemove()
+ static bool HandleDeserterInstanceRemove(ChatHandler* handler, char const* args)
+ {
+ return HandleDeserterRemove(handler, args, true);
+ }
+
+ /// @sa HandleDeserterRemove()
+ static bool HandleDeserterBGRemove(ChatHandler* handler, char const* args)
+ {
+ return HandleDeserterRemove(handler, args, false);
+ }
+};
+
+void AddSC_deserter_commandscript()
+{
+ new deserter_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index a2d8e557ea1..3bdd0fbe132 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -174,7 +174,7 @@ public:
return false;
}
- // TODO: is it really necessary to add both the real and DB table guid here ?
+ /// @todo is it really necessary to add both the real and DB table guid here ?
sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow));
handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, objectId, objectInfo->name.c_str(), guidLow, x, y, z);
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index e695a171255..8357b0ec090 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -35,6 +35,7 @@
#include "Pet.h"
#include "LFG.h"
#include "GroupMgr.h"
+#include "MMapFactory.h"
class misc_commandscript : public CommandScript
{
@@ -190,8 +191,9 @@ public:
uint32 zoneId, areaId;
object->GetZoneAndAreaId(zoneId, areaId);
+ uint32 mapId = object->GetMapId();
- MapEntry const* mapEntry = sMapStore.LookupEntry(object->GetMapId());
+ MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
@@ -210,8 +212,9 @@ public:
int gridX = 63 - gridCoord.x_coord;
int gridY = 63 - gridCoord.y_coord;
- uint32 haveMap = Map::ExistMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
- uint32 haveVMap = Map::ExistVMap(object->GetMapId(), gridX, gridY) ? 1 : 0;
+ uint32 haveMap = Map::ExistMap(mapId, gridX, gridY) ? 1 : 0;
+ uint32 haveVMap = Map::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
+ uint32 haveMMap = (MMAP::MMapFactory::IsPathfindingEnabled(mapId) && MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId())) ? 1 : 0;
if (haveVMap)
{
@@ -224,13 +227,13 @@ public:
handler->PSendSysMessage("no VMAP available for area info");
handler->PSendSysMessage(LANG_MAP_POSITION,
- object->GetMapId(), (mapEntry ? mapEntry->name : "<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(),
- zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap);
+ zoneX, zoneY, groundZ, floorZ, haveMap, haveVMap, haveMMap);
LiquidData liquidStatus;
ZLiquidStatus status = map->getLiquidStatus(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), MAP_ALL_LIQUIDS, &liquidStatus);
@@ -2209,7 +2212,7 @@ public:
// from console show not existed sender
MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
- //- TODO: Fix poor design
+ /// @todo Fix poor design
SQLTransaction trans = CharacterDatabase.BeginTransaction();
MailDraft(subject, text)
.SendMailTo(trans, MailReceiver(target, GUID_LOPART(targetGuid)), sender);
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 466cd318b68..809b6e8db74 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -1251,6 +1251,7 @@ public:
}
target->GetReputationMgr().SetOneFactionReputation(factionEntry, amount, false);
+ target->GetReputationMgr().SendState(target->GetReputationMgr().GetState(factionEntry));
handler->PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name, factionId,
handler->GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry));
return true;
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index 06f8aecef04..e60fd36a375 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -82,7 +82,7 @@ public:
{ "item", SEC_GAMEMASTER, false, &HandleNpcAddVendorItemCommand, "", NULL },
{ "move", SEC_GAMEMASTER, false, &HandleNpcAddMoveCommand, "", NULL },
{ "temp", SEC_GAMEMASTER, false, &HandleNpcAddTempSpawnCommand, "", NULL },
- //{ TODO: fix or remove this command
+ //{@todo fix or remove this command
{ "weapon", SEC_ADMINISTRATOR, false, &HandleNpcAddWeaponCommand, "", NULL },
//}
{ "", SEC_GAMEMASTER, false, &HandleNpcAddCommand, "", NULL },
@@ -114,7 +114,7 @@ public:
{ "spawndist", SEC_GAMEMASTER, false, &HandleNpcSetSpawnDistCommand, "", NULL },
{ "spawntime", SEC_GAMEMASTER, false, &HandleNpcSetSpawnTimeCommand, "", NULL },
{ "data", SEC_ADMINISTRATOR, false, &HandleNpcSetDataCommand, "", NULL },
- //{ TODO: fix or remove these commands
+ //{ @todo fix or remove these commands
{ "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "", NULL },
{ "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "", NULL },
//}
@@ -651,7 +651,7 @@ public:
handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
handler->PSendSysMessage(LANG_NPCINFO_EQUIPMENT, target->GetCurrentEquipmentId(), target->GetOriginalEquipmentId());
handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
- handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction());
+ handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_FIELD_FLAGS_2), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction());
handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
handler->PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->lootid, cInfo->pickpocketLootId, cInfo->SkinLootId);
handler->PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId());
@@ -1425,7 +1425,7 @@ public:
return true;
}
- //TODO: NpcCommands that need to be fixed :
+ /// @todo NpcCommands that need to be fixed :
static bool HandleNpcAddWeaponCommand(ChatHandler* /*handler*/, char const* /*args*/)
{
/*if (!*args)
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 4cf41a8d087..b162e0c51a4 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -704,7 +704,7 @@ public:
wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
- //TODO: Should we first use "Create" then use "LoadFromDB"?
+ /// @todo Should we first use "Create" then use "LoadFromDB"?
if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetDBTableGUIDLow(), map))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);