Some refactoring of code. and some cleanups

This commit is contained in:
hondacrx
2019-09-21 12:11:16 -04:00
parent 7c405230cc
commit 35c06c09fd
214 changed files with 1235 additions and 1341 deletions
+10 -10
View File
@@ -59,14 +59,14 @@ namespace Game.Chat
return false;
}
creatureTarget.setDeathState(DeathState.JustDied);
creatureTarget.SetDeathState(DeathState.JustDied);
creatureTarget.RemoveCorpse();
creatureTarget.SetHealth(0); // just for nice GM-mode view
pet.SetCreatorGUID(player.GetGUID());
pet.SetFaction(player.GetFaction());
if (!pet.InitStatsForLevel(creatureTarget.getLevel()))
if (!pet.InitStatsForLevel(creatureTarget.GetLevel()))
{
Log.outError(LogFilter.ChatSystem, "InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
handler.SendSysMessage("Error 2");
@@ -74,7 +74,7 @@ namespace Game.Chat
}
// prepare visual effect for levelup
pet.SetLevel(creatureTarget.getLevel() - 1);
pet.SetLevel(creatureTarget.GetLevel() - 1);
pet.GetCharmInfo().SetPetNumber(Global.ObjectMgr.GeneratePetNumber(), true);
// this enables pet details window (Shift+P)
@@ -84,7 +84,7 @@ namespace Game.Chat
pet.GetMap().AddToMap(pet.ToCreature());
// visual effect for levelup
pet.SetLevel(creatureTarget.getLevel());
pet.SetLevel(creatureTarget.GetLevel());
player.SetMinion(pet, true);
pet.SavePetToDB(PetSaveMode.AsCurrent);
@@ -125,7 +125,7 @@ namespace Game.Chat
return false;
}
pet.learnSpell(spellId);
pet.LearnSpell(spellId);
handler.SendSysMessage("Pet has learned spell {0}", spellId);
return true;
@@ -147,7 +147,7 @@ namespace Game.Chat
uint spellId = handler.extractSpellIdFromLink(args);
if (pet.HasSpell(spellId))
pet.removeSpell(spellId, false);
pet.RemoveSpell(spellId, false);
else
handler.SendSysMessage("Pet doesn't have that spell");
@@ -167,18 +167,18 @@ namespace Game.Chat
int level = args.NextInt32();
if (level == 0)
level = (int)(owner.getLevel() - pet.getLevel());
level = (int)(owner.GetLevel() - pet.GetLevel());
if (level == 0 || level < -SharedConst.StrongMaxLevel || level > SharedConst.StrongMaxLevel)
{
handler.SendSysMessage(CypherStrings.BadValue);
return false;
}
int newLevel = (int)pet.getLevel() + level;
int newLevel = (int)pet.GetLevel() + level;
if (newLevel < 1)
newLevel = 1;
else if (newLevel > owner.getLevel())
newLevel = (int)owner.getLevel();
else if (newLevel > owner.GetLevel())
newLevel = (int)owner.GetLevel();
pet.GivePetLevel(newLevel);
return true;