mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[12632] Revert previous commit (see Notes)
This commit is contained in:
parent
1cd806c02e
commit
ef445ea523
1462 changed files with 9689 additions and 7080 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information
|
||||
* This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
|
||||
*
|
||||
* 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
|
||||
|
|
@ -413,6 +413,7 @@ ChatCommand* ChatHandler::getCommandTable()
|
|||
static ChatCommand modifyCommandTable[] =
|
||||
{
|
||||
{ "currency", SEC_GAMEMASTER, false, &ChatHandler::HandleModifyCurrencyCommand, "", NULL },
|
||||
{ "holypower", SEC_MODERATOR, false, &ChatHandler::HandleModifyHolyPowerCommand, "", NULL },
|
||||
{ "hp", SEC_MODERATOR, false, &ChatHandler::HandleModifyHPCommand, "", NULL },
|
||||
{ "mana", SEC_MODERATOR, false, &ChatHandler::HandleModifyManaCommand, "", NULL },
|
||||
{ "rage", SEC_MODERATOR, false, &ChatHandler::HandleModifyRageCommand, "", NULL },
|
||||
|
|
@ -533,19 +534,23 @@ ChatCommand* ChatHandler::getCommandTable()
|
|||
{ "creature_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesCreatureCommand, "", NULL },
|
||||
{ "creature_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadCreatureQuestRelationsCommand, "", NULL },
|
||||
{ "db_script_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDbScriptStringCommand, "", NULL },
|
||||
{ "dbscripts_on_creature_death", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDBScriptsOnCreatureDeathCommand,"", NULL },
|
||||
{ "dbscripts_on_event", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDBScriptsOnEventCommand, "", NULL },
|
||||
{ "dbscripts_on_gossip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDBScriptsOnGossipCommand, "", NULL },
|
||||
{ "dbscripts_on_go_use", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDBScriptsOnGoUseCommand, "", NULL },
|
||||
{ "dbscripts_on_quest_end", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDBScriptsOnQuestEndCommand, "", NULL },
|
||||
{ "dbscripts_on_quest_start", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDBScriptsOnQuestStartCommand, "", NULL },
|
||||
{ "dbscripts_on_spell", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadDBScriptsOnSpellCommand, "", NULL },
|
||||
{ "disenchant_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesDisenchantCommand, "", NULL },
|
||||
{ "event_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadEventScriptsCommand, "", NULL },
|
||||
{ "fishing_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesFishingCommand, "", NULL },
|
||||
{ "game_graveyard_zone", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameGraveyardZoneCommand, "", NULL },
|
||||
{ "game_tele", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameTeleCommand, "", NULL },
|
||||
{ "gameobject_involvedrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestInvRelationsCommand, "", NULL },
|
||||
{ "gameobject_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesGameobjectCommand, "", NULL },
|
||||
{ "gameobject_questrelation", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGOQuestRelationsCommand, "", NULL },
|
||||
{ "gameobject_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameObjectScriptsCommand, "", NULL },
|
||||
{ "gameobject_battleground", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadBattleEventCommand, "", NULL },
|
||||
{ "gossip_menu", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuCommand, "", NULL },
|
||||
{ "gossip_menu_option", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipMenuCommand, "", NULL },
|
||||
{ "gossip_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGossipScriptsCommand, "", NULL },
|
||||
{ "item_convert", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemConvertCommand, "", NULL },
|
||||
{ "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL },
|
||||
{ "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL },
|
||||
|
|
@ -572,9 +577,7 @@ ChatCommand* ChatHandler::getCommandTable()
|
|||
{ "pickpocketing_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesPickpocketingCommand, "", NULL},
|
||||
{ "points_of_interest", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadPointsOfInterestCommand, "", NULL },
|
||||
{ "prospecting_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesProspectingCommand, "", NULL },
|
||||
{ "quest_end_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestEndScriptsCommand, "", NULL },
|
||||
{ "quest_poi", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestPOICommand, "", NULL },
|
||||
{ "quest_start_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestStartScriptsCommand, "", NULL },
|
||||
{ "quest_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadQuestTemplateCommand, "", NULL },
|
||||
{ "reference_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesReferenceCommand, "", NULL },
|
||||
{ "reserved_name", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadReservedNameCommand, "", NULL },
|
||||
|
|
@ -594,7 +597,6 @@ ChatCommand* ChatHandler::getCommandTable()
|
|||
{ "spell_proc_event", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellProcEventCommand, "", NULL },
|
||||
{ "spell_proc_item_enchant", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellProcItemEnchantCommand, "", NULL },
|
||||
{ "spell_script_target", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptTargetCommand, "", NULL },
|
||||
{ "spell_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellScriptsCommand, "", NULL },
|
||||
{ "spell_target_position", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL },
|
||||
{ "spell_threats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL },
|
||||
|
||||
|
|
@ -848,7 +850,6 @@ ChatCommand* ChatHandler::getCommandTable()
|
|||
std::string name = fields[0].GetCppString();
|
||||
|
||||
SetDataForCommandInTable(commandTable, name.c_str(), fields[1].GetUInt16(), fields[2].GetCppString());
|
||||
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
|
|
@ -1068,7 +1069,7 @@ void ChatHandler::CheckIntegrity(ChatCommand* table, ChatCommand* parentCommand)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Search (sub)command for command line available for chat handler access level
|
||||
*
|
||||
* @param text Command line string that will parsed for (sub)command search
|
||||
|
|
@ -1083,7 +1084,7 @@ ChatCommand const* ChatHandler::FindCommand(char const* text)
|
|||
return FindCommand(getCommandTable(), textPtr, command) == CHAT_COMMAND_OK ? command : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Search (sub)command for command line available for chat handler access level with options and fail case additional info
|
||||
*
|
||||
* @param table Pointer to command C-style array first level command where will be searched
|
||||
|
|
@ -1216,7 +1217,7 @@ ChatCommandSearchResult ChatHandler::FindCommand(ChatCommand* table, char const*
|
|||
return CHAT_COMMAND_UNKNOWN;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Execute (sub)command available for chat handler access level with options in command line string
|
||||
*
|
||||
* @param text Command line string that will parsed for (sub)command search and command specific data
|
||||
|
|
@ -1274,7 +1275,7 @@ void ChatHandler::ExecuteCommand(const char* text)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function find appropriate command and update command security level and help text
|
||||
*
|
||||
* @param commandTable Table for first level command search
|
||||
|
|
@ -1914,7 +1915,7 @@ bool ChatHandler::isValidChatMessage(const char* message)
|
|||
// verify the link name
|
||||
if (linkedCurrency)
|
||||
{
|
||||
if (linkedCurrency->ID == CURRENCY_CONQUEST_ARENA_META || linkedCurrency->ID == CURRENCY_CONQUEST_BG_META)
|
||||
if (linkedCurrency->Category == CURRENCY_CATEGORY_META)
|
||||
return false;
|
||||
|
||||
bool foundName = false;
|
||||
|
|
@ -2214,7 +2215,7 @@ Creature* ChatHandler::getSelectedCreature()
|
|||
return m_session->GetPlayer()->GetMap()->GetAnyTypeCreature(m_session->GetPlayer()->GetSelectionGuid());
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function skip all whitespaces in args string
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2229,7 +2230,7 @@ void ChatHandler::SkipWhiteSpaces(char** args)
|
|||
++(*args);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract to val arg signed integer value or fail
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2259,7 +2260,7 @@ bool ChatHandler::ExtractInt32(char** args, int32& val)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract to val arg optional signed integer value or use default value. Fail if extracted not signed integer.
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2278,7 +2279,7 @@ bool ChatHandler::ExtractOptInt32(char** args, int32& val, int32 defVal)
|
|||
return ExtractInt32(args, val);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract to val arg unsigned integer value or fail
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2311,7 +2312,69 @@ bool ChatHandler::ExtractUInt32Base(char** args, uint32& val, uint32 base)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract to val arg unsigned long value or fail
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @param val return extracted value if function success, in fail case original value unmodified
|
||||
* @return true if value extraction successful
|
||||
*/
|
||||
bool ChatHandler::ExtractUInt64(char** args, uint64& val)
|
||||
{
|
||||
if (!*args || !** args)
|
||||
return false;
|
||||
|
||||
char* tail = *args;
|
||||
|
||||
unsigned long valRaw = strtoul(*args, &tail, 10);
|
||||
|
||||
if (tail != *args && isWhiteSpace(*tail))
|
||||
*(tail++) = '\0';
|
||||
else if (tail && *tail) // some not whitespace symbol
|
||||
return false; // args not modified and can be re-parsed
|
||||
|
||||
if (valRaw > std::numeric_limits<uint64>::max())
|
||||
return false;
|
||||
|
||||
// value successfully extracted
|
||||
val = uint64(valRaw);
|
||||
*args = tail;
|
||||
|
||||
SkipWhiteSpaces(args);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function extract to val arg signed long value or fail
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @param val return extracted value if function success, in fail case original value unmodified
|
||||
* @return true if value extraction successful
|
||||
*/
|
||||
bool ChatHandler::ExtractInt64(char** args, int64& val)
|
||||
{
|
||||
if (!*args || !** args)
|
||||
return false;
|
||||
|
||||
char* tail = *args;
|
||||
|
||||
long valRaw = strtol(*args, &tail, 10);
|
||||
|
||||
if (tail != *args && isWhiteSpace(*tail))
|
||||
*(tail++) = '\0';
|
||||
else if (tail && *tail) // some not whitespace symbol
|
||||
return false; // args not modified and can be re-parsed
|
||||
|
||||
if (valRaw < std::numeric_limits<int64>::min() || valRaw > std::numeric_limits<int64>::max())
|
||||
return false;
|
||||
|
||||
// value successfully extracted
|
||||
val = int64(valRaw);
|
||||
*args = tail;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function extract to val arg optional unsigned integer value or use default value. Fail if extracted not unsigned integer.
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2330,7 +2393,7 @@ bool ChatHandler::ExtractOptUInt32(char** args, uint32& val, uint32 defVal)
|
|||
return ExtractUInt32(args, val);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract to val arg float value or fail
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2359,7 +2422,7 @@ bool ChatHandler::ExtractFloat(char** args, float& val)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract to val arg optional float value or use default value. Fail if extracted not float.
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2378,7 +2441,7 @@ bool ChatHandler::ExtractOptFloat(char** args, float& val, float defVal)
|
|||
return ExtractFloat(args, val);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract name-like string (from non-numeric or special symbol until whitespace)
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2456,7 +2519,7 @@ char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/)
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract quote-like string (any characters guarded by some special character, in our cases ['")
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2505,7 +2568,7 @@ char* ChatHandler::ExtractQuotedArg(char** args, bool asis /*= false*/)
|
|||
return head;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract quote-like string or literal if quote not detected
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2520,7 +2583,7 @@ char* ChatHandler::ExtractQuotedOrLiteralArg(char** args, bool asis /*= false*/)
|
|||
return arg;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract on/off literals as boolean values
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2543,7 +2606,7 @@ bool ChatHandler::ExtractOnOff(char** args, bool& value)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract shift-link-like string (any characters guarded by | and |h|r with some additional internal structure check)
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2732,7 +2795,7 @@ char* ChatHandler::ExtractLinkArg(char** args, char const* const* linkTypes /*=
|
|||
return head;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract name/number/quote/shift-link-like string
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2751,7 +2814,7 @@ char* ChatHandler::ExtractArg(char** args, bool asis /*= false*/)
|
|||
return arg;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract name/quote/number/shift-link-like string, and return it if args have more non-whitespace data
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
@ -2772,7 +2835,7 @@ char* ChatHandler::ExtractOptNotLastArg(char** args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract data from shift-link "|color|LINKTYPE:RETURN:SOMETHING1|h[name]|h|r if linkType == LINKTYPE
|
||||
* It also extract literal/quote if not shift-link in args
|
||||
*
|
||||
|
|
@ -2797,7 +2860,7 @@ char* ChatHandler::ExtractKeyFromLink(char** text, char const* linkType, char**
|
|||
return ExtractKeyFromLink(text, linkTypes, &foundIdx, something1);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract data from shift-link "|color|LINKTYPE:RETURN:SOMETHING1|h[name]|h|r if LINKTYPE in linkTypes array
|
||||
* It also extract literal/quote if not shift-link in args
|
||||
*
|
||||
|
|
@ -2848,7 +2911,7 @@ char* ChatHandler::ExtractKeyFromLink(char** text, char const* const* linkTypes,
|
|||
return keyPair[0];
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract uint32 key from shift-link "|color|LINKTYPE:RETURN|h[name]|h|r if linkType == LINKTYPE
|
||||
* It also extract direct number if not shift-link in args
|
||||
*
|
||||
|
|
@ -3296,7 +3359,7 @@ std::string ChatHandler::ExtractPlayerNameFromLink(char** text)
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Function extract at least one from request player data (pointer/guid/name) from args name/shift-link or selected player if no args
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue