Skip to content

Commit

Permalink
[11214] Implement .debug spellcoefs command
Browse files Browse the repository at this point in the history
Command show default calculated and DB stored coefficients for spell direct/dot heal/damage.
  • Loading branch information
VladimirMangos committed Mar 3, 2011
1 parent 9a43b5e commit 25fd98b
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 4 deletions.
8 changes: 7 additions & 1 deletion sql/mangos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_11205_01_mangos_spell_proc_event` bit(1) default NULL
`required_11214_02_mangos_command` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';

--
Expand Down Expand Up @@ -552,6 +552,7 @@ INSERT INTO `command` VALUES
('debug play sound',1,'Syntax: .debug play sound #soundid\r\n\r\nPlay sound with #soundid.\r\nSound will be play only for you. Other players do not hear this.\r\nWarning: client may have more 5000 sounds...'),
('debug setitemvalue',3,'Syntax: .debug setitemvalue #guid #field [int|hex|bit|float] #value\r\n\r\nSet the field #field of the item #itemguid in your inventroy to value #value.\r\n\r\nUse type arg for set input format: int (decimal number), hex (hex value), bit (bitstring), float. By default expect integer input format.'),
('debug setvalue',3,'Syntax: .debug setvalue #field [int|hex|bit|float] #value\r\n\r\nSet the field #field of the selected target to value #value. If no target is selected, set the content of your field.\r\n\r\nUse type arg for set input format: int (decimal number), hex (hex value), bit (bitstring), float. By default expect integer input format.'),
('debug spellcoefs',3,'Syntax: .debug spellcoefs #pellid\r\n\r\nShow default calculated and DB stored coefficients for direct/dot heal/damage.'),

This comment has been minimized.

Copy link
@Inquisitor

Inquisitor Mar 6, 2011

.debug spellcoefs #pellid

#spellid maybe?

This comment has been minimized.

Copy link
@VladimirMangos

VladimirMangos Mar 9, 2011

Thank you. Fixed in [11234]

('debug spellmods',3,'Syntax: .debug spellmods (flat|pct) #spellMaskBitIndex #spellModOp #value\r\n\r\nSet at client side spellmod affect for spell that have bit set with index #spellMaskBitIndex in spell family mask for values dependent from spellmod #spellModOp to #value.'),
('delticket',2,'Syntax: .delticket all\r\n .delticket #num\r\n .delticket $character_name\r\n\rall to dalete all tickets at server, $character_name to delete ticket of this character, #num to delete ticket #num.'),
('demorph',2,'Syntax: .demorph\r\n\r\nDemorph the selected player.'),
Expand Down Expand Up @@ -3859,6 +3860,11 @@ INSERT INTO `mangos_string` VALUES
(1169,'Scripting library build for different mangosd revision.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1202,'Spell %u %s = %f (*1.88 = %f) DB = %f AP = %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1203,'direct heal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1204,'direct damage',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1205,'dot heal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1206,'dot damage',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1500,'%u - [%s] AutoSpawn: %u MaxLimit: %u Creatures: %u GameObjecs: %u Pools %u Chance: %f %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1501,'%u - |cffffffff|Hpool:%u|h[%s]|h|r AutoSpawn: %u MaxLimit: %u Creatures: %u GameObjecs: %u Pools %u %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1502,'%u - [%s] AutoSpawn: %u MaxLimit: %u Creatures: %u GameObjecs: %u Pools %u %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
Expand Down
10 changes: 10 additions & 0 deletions sql/updates/11214_01_mangos_mangos_string.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ALTER TABLE db_version CHANGE COLUMN required_11205_01_mangos_spell_proc_event required_11214_01_mangos_mangos_string bit;

DELETE FROM mangos_string WHERE entry IN (1202,1203,1204,1205,1206);

INSERT INTO mangos_string VALUES
(1202,'Spell %u %s = %f (*1.88 = %f) DB = %f AP = %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1203,'direct heal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1204,'direct damage',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1205,'dot heal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1206,'dot damage',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
7 changes: 7 additions & 0 deletions sql/updates/11214_02_mangos_command.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALTER TABLE db_version CHANGE COLUMN required_11214_01_mangos_mangos_string required_11214_02_mangos_command bit;

DELETE FROM command WHERE name = 'debug spellcoefs';

INSERT INTO command (name, security, help) VALUES
('debug spellcoefs',3,'Syntax: .debug spellcoefs #pellid\r\n\r\nShow default calculated and DB stored coefficients for direct/dot heal/damage.');

1 change: 1 addition & 0 deletions src/game/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "setitemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetItemValueCommand, "", NULL },
{ "setvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetValueCommand, "", NULL },
{ "spellcheck", SEC_CONSOLE, true, &ChatHandler::HandleDebugSpellCheckCommand, "", NULL },
{ "spellcoefs", SEC_ADMINISTRATOR, true, &ChatHandler::HandleDebugSpellCoefsCommand, "", NULL },
{ "spellmods", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpellModsCommand, "", NULL },
{ "spawnvehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpawnVehicleCommand, "", NULL },
{ "uws", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateWorldStateCommand, "", NULL },
Expand Down
1 change: 1 addition & 0 deletions src/game/Chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class ChatHandler
bool HandleDebugSetValueCommand(char* args);
bool HandleDebugSpawnVehicleCommand(char* args);
bool HandleDebugSpellCheckCommand(char* args);
bool HandleDebugSpellCoefsCommand(char* args);
bool HandleDebugSpellModsCommand(char* args);
bool HandleDebugUpdateWorldStateCommand(char* args);

Expand Down
7 changes: 6 additions & 1 deletion src/game/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,12 @@ enum MangosStrings
// Debug commands
LANG_CINEMATIC_NOT_EXIST = 1200,
LANG_MOVIE_NOT_EXIST = 1201,
// Room for more debug 1202-1299 not used
LANG_SPELLCOEFS = 1202,
LANG_DIRECT_HEAL = 1203,
LANG_DIRECT_DAMAGE = 1204,
LANG_DOT_HEAL = 1205,
LANG_DOT_DAMAGE = 1206,
// Room for more debug 1207-1299 not used

// Reserved for old client release branches specific strings
// Room for old clients 2.x 1300-1399 not used
Expand Down
51 changes: 51 additions & 0 deletions src/game/debugcmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,57 @@ bool ChatHandler::HandleDebugModValueCommand(char* args)
return HandlerDebugModValueHelper(target, field, typeStr, valStr);
}

bool ChatHandler::HandleDebugSpellCoefsCommand(char* args)
{
uint32 spellid = ExtractSpellIdFromLink(&args);
if (!spellid)
return false;

SpellEntry const * spellEntry = sSpellStore.LookupEntry(spellid);
if (!spellEntry)
return false;

SpellBonusEntry const* bonus = sSpellMgr.GetSpellBonusData(spellid);

float direct_calc = CalculateDefaultCoefficient(spellEntry, SPELL_DIRECT_DAMAGE);
float dot_calc = CalculateDefaultCoefficient(spellEntry, DOT);

bool isDirectHeal = false;
for(int i = 0; i < 3; ++i)
{
// Heals (Also count Mana Shield and Absorb effects as heals)
if (spellEntry->Effect[i] == SPELL_EFFECT_HEAL || spellEntry->Effect[i] == SPELL_EFFECT_HEAL_MAX_HEALTH ||
(spellEntry->Effect[i] == SPELL_EFFECT_APPLY_AURA && (spellEntry->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_ABSORB || spellEntry->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL)) )
{
isDirectHeal = true;
break;
}
}

bool isDotHeal = false;
for(int i = 0; i < 3; ++i)
{
// Periodic Heals
if (spellEntry->Effect[i] == SPELL_EFFECT_APPLY_AURA && spellEntry->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL)
{
isDotHeal = true;
break;
}
}

char const* directHealStr = GetMangosString(LANG_DIRECT_HEAL);
char const* directDamageStr = GetMangosString(LANG_DIRECT_DAMAGE);
char const* dotHealStr = GetMangosString(LANG_DOT_HEAL);
char const* dotDamageStr = GetMangosString(LANG_DOT_DAMAGE);

PSendSysMessage(LANG_SPELLCOEFS, spellid, isDirectHeal ? directHealStr : directDamageStr,
direct_calc, direct_calc * 1.88f, bonus ? bonus->direct_damage : 0.0f, bonus ? bonus->ap_bonus : 0.0f);
PSendSysMessage(LANG_SPELLCOEFS, spellid, isDotHeal ? dotHealStr : dotDamageStr,
dot_calc, dot_calc * 1.88f, bonus ? bonus->dot_damage : 0.0f, bonus ? bonus->ap_dot_bonus : 0.0f);

return true;
}

bool ChatHandler::HandleDebugSpellModsCommand(char* args)
{
char* typeStr = ExtractLiteralArg(&args);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11213"
#define REVISION_NR "11214"
#endif // __REVISION_NR_H__
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_11117_02_characters_world"
#define REVISION_DB_MANGOS "required_11205_01_mangos_spell_proc_event"
#define REVISION_DB_MANGOS "required_11214_02_mangos_command"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__

0 comments on commit 25fd98b

Please sign in to comment.