mirror of
https://github.com/mangosfour/server.git
synced 2025-12-22 22:37:06 +00:00
[10314] Implement commands for work with areatriggers in game.
* all teleport commands support new areatrigger and areatriger-target shiftlinks
* .go trigger now let select areatrigger or areatrigger target as teleport point
* New commands:
.trigger - show detail info about areatrigger including all requirements
for teleport with shift-links to items/keys/quest
.trigger active - show all currently activated by character areatriggers
.trigger near - show near areatriggers
* .lookup item now show [usable] postfix if item can be used/equipped by selected character.
This commit is contained in:
parent
835efe7f6a
commit
685edfe7e2
12 changed files with 509 additions and 67 deletions
|
|
@ -40,6 +40,8 @@
|
|||
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
|
||||
// - client, item icon shift click, not used in server currently
|
||||
// |color|Harea:area_id|h[name]|h|r
|
||||
// |color|Hareatrigger:id|h[name]|h|r
|
||||
// |color|Hareatrigger_target:id|h[name]|h|r
|
||||
// |color|Hcreature:creature_guid|h[name]|h|r
|
||||
// |color|Hcreature_entry:creature_id|h[name]|h|r
|
||||
// |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r - client, at shift click in recipes list dialog
|
||||
|
|
@ -610,6 +612,14 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand triggerCommandTable[] =
|
||||
{
|
||||
{ "active", SEC_GAMEMASTER, false, &ChatHandler::HandleTriggerActiveCommand, "", NULL },
|
||||
{ "near", SEC_GAMEMASTER, false, &ChatHandler::HandleTriggerNearCommand, "", NULL },
|
||||
{ "", SEC_GAMEMASTER, true, &ChatHandler::HandleTriggerCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand unbanCommandTable[] =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &ChatHandler::HandleUnBanAccountCommand, "", NULL },
|
||||
|
|
@ -654,6 +664,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ "server", SEC_PLAYER, true, NULL, "", serverCommandTable },
|
||||
{ "tele", SEC_MODERATOR, true, NULL, "", teleCommandTable },
|
||||
{ "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable },
|
||||
{ "trigger", SEC_GAMEMASTER, false, NULL, "", triggerCommandTable },
|
||||
{ "wp", SEC_GAMEMASTER, false, NULL, "", wpCommandTable },
|
||||
|
||||
{ "aura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuraCommand, "", NULL },
|
||||
|
|
@ -2285,7 +2296,9 @@ enum LocationLinkType
|
|||
LOCATION_LINK_CREATURE = 3,
|
||||
LOCATION_LINK_GAMEOBJECT = 4,
|
||||
LOCATION_LINK_CREATURE_ENTRY = 5,
|
||||
LOCATION_LINK_GAMEOBJECT_ENTRY = 6
|
||||
LOCATION_LINK_GAMEOBJECT_ENTRY = 6,
|
||||
LOCATION_LINK_AREATRIGGER = 7,
|
||||
LOCATION_LINK_AREATRIGGER_TARGET= 8,
|
||||
};
|
||||
|
||||
static char const* const locationKeys[] =
|
||||
|
|
@ -2297,6 +2310,8 @@ static char const* const locationKeys[] =
|
|||
"Hgameobject",
|
||||
"Hcreature_entry",
|
||||
"Hgameobject_entry",
|
||||
"Hareatrigger",
|
||||
"Hareatrigger_target",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
@ -2311,6 +2326,8 @@ bool ChatHandler::extractLocationFromLink(char* text, uint32& mapid, float& x, f
|
|||
// |color|Hgameobject:go_guid|h[name]|h|r
|
||||
// |color|Hcreature_entry:creature_id|h[name]|h|r
|
||||
// |color|Hgameobject_entry:go_id|h[name]|h|r
|
||||
// |color|Hareatrigger:id|h[name]|h|r
|
||||
// |color|Hareatrigger_target:id|h[name]|h|r
|
||||
char* idS = extractKeyFromLink(text,locationKeys,&type);
|
||||
if(!idS)
|
||||
return false;
|
||||
|
|
@ -2449,6 +2466,49 @@ bool ChatHandler::extractLocationFromLink(char* text, uint32& mapid, float& x, f
|
|||
else
|
||||
return false;
|
||||
}
|
||||
case LOCATION_LINK_AREATRIGGER:
|
||||
{
|
||||
uint32 id = (uint32)atol(idS);
|
||||
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(id);
|
||||
if (!atEntry)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
mapid = atEntry->mapid;
|
||||
x = atEntry->x;
|
||||
y = atEntry->y;
|
||||
z = atEntry->z;
|
||||
return true;
|
||||
}
|
||||
case LOCATION_LINK_AREATRIGGER_TARGET:
|
||||
{
|
||||
uint32 id = (uint32)atol(idS);
|
||||
|
||||
if (!sAreaTriggerStore.LookupEntry(id))
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
AreaTrigger const* at = sObjectMgr.GetAreaTrigger(id);
|
||||
if(!at)
|
||||
{
|
||||
PSendSysMessage(LANG_AREATRIGER_NOT_HAS_TARGET, id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
mapid = at->target_mapId;
|
||||
x = at->target_X;
|
||||
y = at->target_Y;
|
||||
z = at->target_Z;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// unknown type?
|
||||
|
|
|
|||
|
|
@ -262,6 +262,8 @@ class ChatHandler
|
|||
bool HandleLookupPlayerAccountCommand(const char* args);
|
||||
bool HandleLookupPlayerEmailCommand(const char* args);
|
||||
bool HandleLookupQuestCommand(const char* args);
|
||||
|
||||
void ShowQuestListHelper(uint32 questId, int32 loc_idx, Player* target = NULL);
|
||||
bool HandleLookupSkillCommand(const char* args);
|
||||
bool HandleLookupSpellCommand(const char* args);
|
||||
bool HandleLookupTaxiNodeCommand(const char * args);
|
||||
|
|
@ -462,6 +464,10 @@ class ChatHandler
|
|||
bool HandleTitlesRemoveCommand(const char* args);
|
||||
bool HandleTitlesSetMaskCommand(const char* args);
|
||||
|
||||
bool HandleTriggerActiveCommand(const char* args);
|
||||
bool HandleTriggerNearCommand(const char* args);
|
||||
bool HandleTriggerCommand(const char* args);
|
||||
|
||||
bool HandleUnBanAccountCommand(const char* args);
|
||||
bool HandleUnBanCharacterCommand(const char* args);
|
||||
bool HandleUnBanIPCommand(const char* args);
|
||||
|
|
@ -569,6 +575,9 @@ class ChatHandler
|
|||
void ShowTicket(uint64 guid, char const* text, char const* time);
|
||||
bool ShowAccountListHelper(QueryResult* result, uint32* limit = NULL, bool title = true, bool error = true);
|
||||
bool ShowPlayerListHelper(QueryResult* result, uint32* limit = NULL, bool title = true, bool error = true);
|
||||
void ShowItemListHelper(uint32 itemId, int loc_idx, Player* target = NULL);
|
||||
void ShowTriggerListHelper(AreaTriggerEntry const * atEntry);
|
||||
void ShowTriggerTargetListHelper(uint32 id, AreaTrigger const* at, bool subpart = false);
|
||||
bool LookupPlayerSearchCommand(QueryResult* result, uint32* limit = NULL);
|
||||
bool HandleBanListHelper(QueryResult* result);
|
||||
bool HandleBanHelper(BanMode mode,char const* args);
|
||||
|
|
|
|||
|
|
@ -345,7 +345,22 @@ enum MangosStrings
|
|||
LANG_TITLE_REMOVE_RES = 354,
|
||||
LANG_TITLE_CURRENT_RES = 355,
|
||||
LANG_CURRENT_TITLE_RESET = 356,
|
||||
// Room for more level 2 357-399 not used
|
||||
LANG_AREATRIGER_NOT_HAS_TARGET = 357,
|
||||
LANG_COMMAND_NOTRIGGERFOUND = 358,
|
||||
LANG_TRIGGER_TARGET_LIST_CHAT = 359,
|
||||
LANG_TRIGGER_TARGET_LIST_CONSOLE = 360,
|
||||
LANG_TRIGGER_LIST_CHAT = 361,
|
||||
LANG_TRIGGER_LIST_CONSOLE = 362,
|
||||
LANG_TRIGGER_DIST = 363,
|
||||
LANG_TRIGGER_TAVERN = 364,
|
||||
LANG_TRIGGER_QUEST = 365,
|
||||
LANG_TRIGGER_EXPLORE_QUEST = 366,
|
||||
LANG_TRIGGER_REQ_LEVEL = 367,
|
||||
LANG_TRIGGER_REQ_ITEMS = 368,
|
||||
LANG_TRIGGER_REQ_QUEST_NORMAL = 369,
|
||||
LANG_TRIGGER_REQ_KEYS_HEROIC = 370,
|
||||
LANG_TRIGGER_REQ_QUEST_HEROIC = 371,
|
||||
// Room for more level 2 372-399 not used
|
||||
|
||||
// level 3 chat
|
||||
LANG_SCRIPTS_RELOADED = 400,
|
||||
|
|
@ -852,7 +867,8 @@ enum MangosStrings
|
|||
LANG_NPC_GO_INFO_POOL_STRING = 1149,
|
||||
LANG_NPC_GO_INFO_EVENT_STRING = 1150,
|
||||
LANG_NPC_GO_INFO_POOL_EVENT_STRING = 1151,
|
||||
// Room for more level 3 1152-1199 not used
|
||||
LANG_COMMAND_ITEM_USABLE = 1152,
|
||||
// Room for more level 3 1153-1199 not used
|
||||
|
||||
// Debug commands
|
||||
LANG_CINEMATIC_NOT_EXIST = 1200,
|
||||
|
|
|
|||
|
|
@ -141,6 +141,263 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ChatHandler::ShowTriggerTargetListHelper( uint32 id, AreaTrigger const* at, bool subpart /*= false*/ )
|
||||
{
|
||||
if (m_session)
|
||||
{
|
||||
char dist_buf[50];
|
||||
if(!subpart)
|
||||
{
|
||||
float dist = m_session->GetPlayer()->GetDistance2d(at->target_X, at->target_Y);
|
||||
snprintf(dist_buf, 50, GetMangosString(LANG_TRIGGER_DIST), dist);
|
||||
}
|
||||
else
|
||||
dist_buf[0] = '\0';
|
||||
|
||||
PSendSysMessage(LANG_TRIGGER_TARGET_LIST_CHAT,
|
||||
subpart ? " -> " : "", id, id, at->target_mapId, at->target_X, at->target_Y, at->target_Z, dist_buf);
|
||||
}
|
||||
else
|
||||
PSendSysMessage(LANG_TRIGGER_TARGET_LIST_CONSOLE,
|
||||
subpart ? " -> " : "", id, at->target_mapId, at->target_X, at->target_Y, at->target_Z);
|
||||
}
|
||||
|
||||
void ChatHandler::ShowTriggerListHelper( AreaTriggerEntry const * atEntry )
|
||||
{
|
||||
|
||||
char const* tavern = sObjectMgr.IsTavernAreaTrigger(atEntry->id) ? GetMangosString(LANG_TRIGGER_TAVERN) : "";
|
||||
char const* quest = sObjectMgr.GetQuestForAreaTrigger(atEntry->id) ? GetMangosString(LANG_TRIGGER_QUEST) : "";
|
||||
|
||||
if (m_session)
|
||||
{
|
||||
float dist = m_session->GetPlayer()->GetDistance2d(atEntry->x, atEntry->y);
|
||||
char dist_buf[50];
|
||||
snprintf(dist_buf, 50, GetMangosString(LANG_TRIGGER_DIST), dist);
|
||||
|
||||
PSendSysMessage(LANG_TRIGGER_LIST_CHAT,
|
||||
atEntry->id, atEntry->id, atEntry->mapid, atEntry->x, atEntry->y, atEntry->z, dist_buf, tavern, quest);
|
||||
}
|
||||
else
|
||||
PSendSysMessage(LANG_TRIGGER_LIST_CONSOLE,
|
||||
atEntry->id, atEntry->mapid, atEntry->x, atEntry->y, atEntry->z, tavern, quest);
|
||||
|
||||
if (AreaTrigger const* at = sObjectMgr.GetAreaTrigger(atEntry->id))
|
||||
ShowTriggerTargetListHelper(atEntry->id, at, true);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTriggerCommand(const char* args)
|
||||
{
|
||||
AreaTriggerEntry const* atEntry = NULL;
|
||||
|
||||
Player* pl = m_session ? m_session->GetPlayer() : NULL;
|
||||
|
||||
// select by args
|
||||
if (*args)
|
||||
{
|
||||
char *atId = extractKeyFromLink((char*)args, "Hareatrigger");
|
||||
if (!atId)
|
||||
return false;
|
||||
|
||||
int32 i_atId = atoi(atId);
|
||||
|
||||
if (!i_atId)
|
||||
return false;
|
||||
|
||||
atEntry = sAreaTriggerStore.LookupEntry(i_atId);
|
||||
|
||||
if (!atEntry)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, i_atId);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// find nearest
|
||||
else
|
||||
{
|
||||
if (!m_session)
|
||||
return false;
|
||||
|
||||
float dist2 = MAP_SIZE*MAP_SIZE;
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
|
||||
// Search triggers
|
||||
for (uint32 id = 0; id < sAreaTriggerStore.GetNumRows (); ++id)
|
||||
{
|
||||
AreaTriggerEntry const *atTestEntry = sAreaTriggerStore.LookupEntry (id);
|
||||
if (!atTestEntry)
|
||||
continue;
|
||||
|
||||
if (atTestEntry->mapid != m_session->GetPlayer()->GetMapId())
|
||||
continue;
|
||||
|
||||
float dx = atTestEntry->x - pl->GetPositionX();
|
||||
float dy = atTestEntry->y - pl->GetPositionY();
|
||||
|
||||
float test_dist2 = dx*dx + dy*dy;
|
||||
|
||||
if (test_dist2 >= dist2)
|
||||
continue;
|
||||
|
||||
dist2 = test_dist2;
|
||||
atEntry = atTestEntry;
|
||||
}
|
||||
|
||||
if (!atEntry)
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_NOTRIGGERFOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ShowTriggerListHelper(atEntry);
|
||||
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
|
||||
AreaTrigger const* at = sObjectMgr.GetAreaTrigger(atEntry->id);
|
||||
if (at)
|
||||
PSendSysMessage(LANG_TRIGGER_REQ_LEVEL, at->requiredLevel);
|
||||
|
||||
if (uint32 quest_id = sObjectMgr.GetQuestForAreaTrigger(atEntry->id))
|
||||
{
|
||||
SendSysMessage(LANG_TRIGGER_EXPLORE_QUEST);
|
||||
ShowQuestListHelper(quest_id, loc_idx, pl);
|
||||
}
|
||||
|
||||
if (at)
|
||||
{
|
||||
if (at->requiredItem || at->requiredItem2)
|
||||
{
|
||||
SendSysMessage(LANG_TRIGGER_REQ_ITEMS);
|
||||
|
||||
if (at->requiredItem)
|
||||
ShowItemListHelper(at->requiredItem, loc_idx, pl);
|
||||
if (at->requiredItem2)
|
||||
ShowItemListHelper(at->requiredItem2, loc_idx, pl);
|
||||
}
|
||||
|
||||
if (at->requiredQuest)
|
||||
{
|
||||
SendSysMessage(LANG_TRIGGER_REQ_QUEST_NORMAL);
|
||||
ShowQuestListHelper(at->requiredQuest, loc_idx, pl);
|
||||
}
|
||||
|
||||
if (at->heroicKey || at->heroicKey2)
|
||||
{
|
||||
SendSysMessage(LANG_TRIGGER_REQ_KEYS_HEROIC);
|
||||
|
||||
if (at->heroicKey)
|
||||
ShowItemListHelper(at->heroicKey, loc_idx, pl);
|
||||
if (at->heroicKey2)
|
||||
ShowItemListHelper(at->heroicKey2, loc_idx, pl);
|
||||
}
|
||||
|
||||
if (at->requiredQuestHeroic)
|
||||
{
|
||||
SendSysMessage(LANG_TRIGGER_REQ_QUEST_HEROIC);
|
||||
ShowQuestListHelper(at->requiredQuestHeroic, loc_idx, pl);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTriggerActiveCommand(const char* args)
|
||||
{
|
||||
uint32 counter = 0; // Counter for figure out that we found smth.
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
|
||||
// Search in AreaTable.dbc
|
||||
for (uint32 id = 0; id < sAreaTriggerStore.GetNumRows (); ++id)
|
||||
{
|
||||
AreaTriggerEntry const *atEntry = sAreaTriggerStore.LookupEntry (id);
|
||||
if (!atEntry)
|
||||
continue;
|
||||
|
||||
if (!IsPointInAreaTriggerZone(atEntry, pl->GetMapId(), pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ()))
|
||||
continue;
|
||||
|
||||
ShowTriggerListHelper(atEntry);
|
||||
|
||||
++counter;
|
||||
}
|
||||
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
SendSysMessage (LANG_COMMAND_NOTRIGGERFOUND);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleTriggerNearCommand(const char* args)
|
||||
{
|
||||
float distance = (!*args) ? 10.0f : (float)atof(args);
|
||||
float dist2 = distance*distance;
|
||||
uint32 counter = 0; // Counter for figure out that we found smth.
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
|
||||
// Search triggers
|
||||
for (uint32 id = 0; id < sAreaTriggerStore.GetNumRows (); ++id)
|
||||
{
|
||||
AreaTriggerEntry const *atEntry = sAreaTriggerStore.LookupEntry (id);
|
||||
if (!atEntry)
|
||||
continue;
|
||||
|
||||
if (atEntry->mapid != m_session->GetPlayer()->GetMapId())
|
||||
continue;
|
||||
|
||||
float dx = atEntry->x - pl->GetPositionX();
|
||||
float dy = atEntry->y - pl->GetPositionY();
|
||||
|
||||
if (dx*dx + dy*dy > dist2)
|
||||
continue;
|
||||
|
||||
ShowTriggerListHelper(atEntry);
|
||||
|
||||
++counter;
|
||||
}
|
||||
|
||||
// Search trigger targets
|
||||
for (uint32 id = 0; id < sAreaTriggerStore.GetNumRows (); ++id)
|
||||
{
|
||||
AreaTriggerEntry const *atEntry = sAreaTriggerStore.LookupEntry (id);
|
||||
if (!atEntry)
|
||||
continue;
|
||||
|
||||
AreaTrigger const* at = sObjectMgr.GetAreaTrigger(atEntry->id);
|
||||
if (!at)
|
||||
continue;
|
||||
|
||||
if (at->target_mapId != m_session->GetPlayer()->GetMapId())
|
||||
continue;
|
||||
|
||||
float dx = at->target_X - pl->GetPositionX();
|
||||
float dy = at->target_Y - pl->GetPositionY();
|
||||
|
||||
if (dx*dx + dy*dy > dist2)
|
||||
continue;
|
||||
|
||||
ShowTriggerTargetListHelper(atEntry->id, at);
|
||||
|
||||
++counter;
|
||||
}
|
||||
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
SendSysMessage (LANG_COMMAND_NOTRIGGERFOUND);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static char const* const areatriggerKeys[] =
|
||||
{
|
||||
"Hareatrigger",
|
||||
"Hareatrigger_target",
|
||||
NULL
|
||||
};
|
||||
|
||||
bool ChatHandler::HandleGoTriggerCommand(const char* args)
|
||||
{
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
|
@ -148,7 +405,9 @@ bool ChatHandler::HandleGoTriggerCommand(const char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
char *atId = strtok((char*)args, " ");
|
||||
int keyIdx; // not index
|
||||
|
||||
char *atId = extractKeyFromLink((char*)args, areatriggerKeys, &keyIdx);
|
||||
if (!atId)
|
||||
return false;
|
||||
|
||||
|
|
@ -157,15 +416,36 @@ bool ChatHandler::HandleGoTriggerCommand(const char* args)
|
|||
if (!i_atId)
|
||||
return false;
|
||||
|
||||
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(i_atId);
|
||||
if (!at)
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(i_atId);
|
||||
if (!atEntry)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND,i_atId);
|
||||
PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, i_atId);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return HandleGoHelper(_player, at->mapid, at->x, at->y, &at->z);
|
||||
char* target_str = strtok(NULL, " ");
|
||||
if (target_str)
|
||||
{
|
||||
int l = strlen(target_str);
|
||||
if (strncmp(target_str, "target", l) != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target_str != NULL)
|
||||
{
|
||||
AreaTrigger const* at = sObjectMgr.GetAreaTrigger(i_atId);
|
||||
if (!at)
|
||||
{
|
||||
PSendSysMessage(LANG_AREATRIGER_NOT_HAS_TARGET, i_atId);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return HandleGoHelper(_player, at->target_mapId, at->target_X, at->target_Y, &at->target_Z);
|
||||
}
|
||||
else
|
||||
return HandleGoHelper(_player, atEntry->mapid, atEntry->x, atEntry->y, &atEntry->z);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleGoGraveyardCommand(const char* args)
|
||||
|
|
|
|||
|
|
@ -2634,6 +2634,35 @@ bool ChatHandler::HandleListCreatureCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ChatHandler::ShowItemListHelper( uint32 itemId, int loc_idx, Player* target /*=NULL*/ )
|
||||
{
|
||||
ItemPrototype const *itemProto = sItemStorage.LookupEntry<ItemPrototype >(itemId);
|
||||
if(!itemProto)
|
||||
return;
|
||||
|
||||
std::string name;
|
||||
|
||||
if(ItemLocale const *il = loc_idx >= 0 ? sObjectMgr.GetItemLocale(itemProto->ItemId) : NULL)
|
||||
name = il->Name[loc_idx];
|
||||
|
||||
if (name.empty())
|
||||
name = itemProto->Name1;
|
||||
|
||||
char const* usableStr = "";
|
||||
|
||||
if (target)
|
||||
{
|
||||
if (target->CanUseItem(itemProto))
|
||||
usableStr = GetMangosString(LANG_COMMAND_ITEM_USABLE);
|
||||
}
|
||||
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_ITEM_LIST_CHAT, itemId, itemId, name.c_str(), usableStr);
|
||||
else
|
||||
PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itemId, name.c_str(), usableStr);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleLookupItemCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
|
|
@ -2648,6 +2677,8 @@ bool ChatHandler::HandleLookupItemCommand(const char* args)
|
|||
|
||||
wstrToLower(wnamepart);
|
||||
|
||||
Player* pl = m_session ? m_session->GetPlayer() : NULL;
|
||||
|
||||
uint32 counter = 0;
|
||||
|
||||
// Search in `item_template`
|
||||
|
|
@ -2669,10 +2700,7 @@ bool ChatHandler::HandleLookupItemCommand(const char* args)
|
|||
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());
|
||||
else
|
||||
PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str());
|
||||
ShowItemListHelper(pProto->ItemId, loc_idx, pl);
|
||||
++counter;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2686,10 +2714,7 @@ bool ChatHandler::HandleLookupItemCommand(const char* args)
|
|||
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_ITEM_LIST_CHAT, id, id, name.c_str());
|
||||
else
|
||||
PSendSysMessage(LANG_ITEM_LIST_CONSOLE, id, name.c_str());
|
||||
ShowItemListHelper(pProto->ItemId, -1, pl);
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
|
|
@ -2944,6 +2969,44 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ChatHandler::ShowQuestListHelper( uint32 questId, int32 loc_idx, Player* target /*= NULL*/ )
|
||||
{
|
||||
Quest const* qinfo = sObjectMgr.GetQuestTemplate(questId);
|
||||
if (!qinfo)
|
||||
return;
|
||||
|
||||
std::string title;
|
||||
|
||||
if (QuestLocale const *il = loc_idx >= 0 ? sObjectMgr.GetQuestLocale(qinfo->GetQuestId()) : NULL)
|
||||
title = il->Title[loc_idx];
|
||||
|
||||
if (title.empty())
|
||||
title = qinfo->GetTitle();
|
||||
|
||||
char const* statusStr = "";
|
||||
|
||||
if (target)
|
||||
{
|
||||
QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
|
||||
|
||||
if (status == QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
if (target->GetQuestRewardStatus(qinfo->GetQuestId()))
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED);
|
||||
else
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE);
|
||||
}
|
||||
else if (status == QUEST_STATUS_INCOMPLETE)
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE);
|
||||
}
|
||||
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_QUEST_LIST_CHAT, qinfo->GetQuestId(), qinfo->GetQuestId(), qinfo->GetQuestLevel(), title.c_str(), statusStr);
|
||||
else
|
||||
PSendSysMessage(LANG_QUEST_LIST_CONSOLE, qinfo->GetQuestId(), title.c_str(), statusStr);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleLookupQuestCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
|
|
@ -2980,27 +3043,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args)
|
|||
|
||||
if (Utf8FitTo(title, wnamepart))
|
||||
{
|
||||
char const* statusStr = "";
|
||||
|
||||
if(target)
|
||||
{
|
||||
QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
|
||||
|
||||
if(status == QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
if(target->GetQuestRewardStatus(qinfo->GetQuestId()))
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED);
|
||||
else
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE);
|
||||
}
|
||||
else if(status == QUEST_STATUS_INCOMPLETE)
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE);
|
||||
}
|
||||
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),qinfo->GetQuestLevel(),title.c_str(),statusStr);
|
||||
else
|
||||
PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr);
|
||||
ShowQuestListHelper(qinfo->GetQuestId(), loc_idx, target);
|
||||
++counter;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -3014,28 +3057,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args)
|
|||
|
||||
if (Utf8FitTo(title, wnamepart))
|
||||
{
|
||||
char const* statusStr = "";
|
||||
|
||||
if(target)
|
||||
{
|
||||
QuestStatus status = target->GetQuestStatus(qinfo->GetQuestId());
|
||||
|
||||
if(status == QUEST_STATUS_COMPLETE)
|
||||
{
|
||||
if(target->GetQuestRewardStatus(qinfo->GetQuestId()))
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_REWARDED);
|
||||
else
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_COMPLETE);
|
||||
}
|
||||
else if(status == QUEST_STATUS_INCOMPLETE)
|
||||
statusStr = GetMangosString(LANG_COMMAND_QUEST_ACTIVE);
|
||||
}
|
||||
|
||||
if (m_session)
|
||||
PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),qinfo->GetQuestLevel(),title.c_str(),statusStr);
|
||||
else
|
||||
PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr);
|
||||
|
||||
ShowQuestListHelper(qinfo->GetQuestId(), -1, target);
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -722,10 +722,11 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
|||
}
|
||||
|
||||
// enter to tavern, not overwrite city rest
|
||||
if(sObjectMgr.IsTavernAreaTrigger(Trigger_ID) && pl->GetRestType() != REST_TYPE_IN_CITY)
|
||||
if(sObjectMgr.IsTavernAreaTrigger(Trigger_ID))
|
||||
{
|
||||
// set resting flag we are in the inn
|
||||
pl->SetRestType(REST_TYPE_IN_TAVERN, Trigger_ID);
|
||||
if (pl->GetRestType() != REST_TYPE_IN_CITY)
|
||||
pl->SetRestType(REST_TYPE_IN_TAVERN, Trigger_ID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10313"
|
||||
#define REVISION_NR "10314"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_10312_02_characters_pet_aura"
|
||||
#define REVISION_DB_MANGOS "required_10307_03_mangos_scripted_event_id"
|
||||
#define REVISION_DB_MANGOS "required_10314_02_mangos_command"
|
||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue