Skip to content

Commit

Permalink
- Add 4 spell effects (KillCreditPersonal, WMOChange, WMORepair, WMOD…
Browse files Browse the repository at this point in the history
…amage)

- Update enum GameObjectFlags for type 33 (Destructible building) and enum ImplicitSpellTargetType
- Typo in Map.cs
  • Loading branch information
pauljenny committed Jun 13, 2011
1 parent 715b6b9 commit ddd1168
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 10 deletions.
8 changes: 6 additions & 2 deletions Core/WCell.Constants/GameObjects/GOConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ public enum GameObjectFlags // :ushort

GOFlag_0x80 = 0x80,
GOFlag_0x100 = 0x100,
GOFlag_0x200 = 0x200,
GOFlag_0x400 = 0x400,
/// <summary>
/// Use for GO type 33
/// </summary>
Damaged = 0x200,
Destroyed = 0x400,

GOFlag_0x800 = 0x800,
GOFlag_0x1000 = 0x1000,
GOFlag_0x2000 = 0x2000,
Expand Down
6 changes: 3 additions & 3 deletions Core/WCell.Constants/Spells/ImplicitSpellTargetType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ public enum ImplicitSpellTargetType
AreaEffectPartyAndClass = 61,
//Unused_PriestChampion = 62,
NatureSummonLocation = 63,
Type_64 = 64,
InFrontOfTargetLocation = 64,
/// <summary>
/// Eg Shadowstep, Warp etc
/// </summary>
BehindTargetLocation = 65,
Type_66 = 66,
Type_67 = 67,
RightFromTargetLocation = 66,
LeftFromTargetLocation = 67,
Type_68 = 68,
Type_69 = 69,
Type_70 = 70,
Expand Down
8 changes: 4 additions & 4 deletions Core/WCell.Constants/Spells/SpellEffectType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ public enum SpellEffectType
Stuck,
SummonPlayer = 85,
ActivateObject,
Unused_SummonTotemSlot1,
Unused_SummonTotemSlot2,
Unused_SummonTotemSlot3,
Unused_SummonTotemSlot4 = 90,
WMODamage = 87,
WMORepair = 88,
WMOChange = 89,
KillCreditPersonal = 90,
Unused_ThreatAll = 91,
EnchantHeldItem = 92,
Unused_SummonPhantasm = 93,
Expand Down
2 changes: 1 addition & 1 deletion Services/WCell.RealmServer/Global/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2587,7 +2587,7 @@ protected internal virtual void OnPlayerDeath(IDamageAction action)
}

/// <summary>
/// Is called whenevr an honorable character was killed by another character
/// Is called whenever an honorable character was killed by another character
/// </summary>
/// <param name="action"></param>
protected internal virtual void OnHonorableKill(IDamageAction action)
Expand Down
35 changes: 35 additions & 0 deletions Services/WCell.RealmServer/Spells/Effects/KillCreditPersonal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WCell.Constants.Updates;
using WCell.RealmServer.Entities;
using WCell.RealmServer.NPCs;

namespace WCell.RealmServer.Spells.Effects
{
public class KillCreditPersonal : SpellEffectHandler
{
public KillCreditPersonal(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}

protected override void Apply(WorldObject target)
{
var chr = target as Character;
if (m_cast.CasterUnit != null && m_cast.CasterUnit is NPC)
{
chr.QuestLog.OnNPCInteraction((NPC)m_cast.CasterUnit);
}
}

public override ObjectTypes TargetType
{
get
{
return ObjectTypes.Player;
}
}
}
}
43 changes: 43 additions & 0 deletions Services/WCell.RealmServer/Spells/Effects/WMOChange.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using WCell.Constants.GameObjects;
using WCell.Constants.Spells;
using WCell.Constants.Updates;
using WCell.RealmServer.Entities;

namespace WCell.RealmServer.Spells.Effects
{
// TODO : Change the state of the GO according to the MiscValue (0 = Intact, 1 = Damaged, 2 = Destroyed, 3 = Rebuild)
public class WMOChange : SpellEffectHandler
{
public WMOChange(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}

public override SpellFailedReason InitializeTarget(WorldObject target)
{
if (!(target is GameObject))
{
return SpellFailedReason.NoValidTargets;
}

if (((GameObject)target).GOType != GameObjectType.DestructibleBuilding)
{
return SpellFailedReason.BadTargets;
}

return SpellFailedReason.Ok;
}

protected override void Apply(WorldObject target)
{
}

public override ObjectTypes TargetType
{
get
{
return ObjectTypes.GameObject; // Not sure (perhaps DynamicObject)
}
}
}
}
43 changes: 43 additions & 0 deletions Services/WCell.RealmServer/Spells/Effects/WMODamage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using WCell.Constants.GameObjects;
using WCell.Constants.Spells;
using WCell.Constants.Updates;
using WCell.RealmServer.Entities;

namespace WCell.RealmServer.Spells.Effects
{
// TODO : Do damage to the GO
public class WMODamage : SpellEffectHandler
{
public WMODamage(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}

public override SpellFailedReason InitializeTarget(WorldObject target)
{
if (!(target is GameObject))
{
return SpellFailedReason.NoValidTargets;
}

if (((GameObject)target).GOType != GameObjectType.DestructibleBuilding)
{
return SpellFailedReason.BadTargets;
}

return SpellFailedReason.Ok;
}

protected override void Apply(WorldObject target)
{
}

public override ObjectTypes TargetType
{
get
{
return ObjectTypes.GameObject; // Not sure (perhaps DynamicObject)
}
}
}
}
43 changes: 43 additions & 0 deletions Services/WCell.RealmServer/Spells/Effects/WMORepair.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using WCell.Constants.GameObjects;
using WCell.Constants.Spells;
using WCell.Constants.Updates;
using WCell.RealmServer.Entities;

namespace WCell.RealmServer.Spells.Effects
{
// TODO : Repair (set the max health to) the GO
public class WMORepair : SpellEffectHandler
{
public WMORepair(SpellCast cast, SpellEffect effect)
: base(cast, effect)
{
}

public override SpellFailedReason InitializeTarget(WorldObject target)
{
if (!(target is GameObject))
{
return SpellFailedReason.NoValidTargets;
}

if (((GameObject)target).GOType != GameObjectType.DestructibleBuilding)
{
return SpellFailedReason.BadTargets;
}

return SpellFailedReason.Ok;
}

protected override void Apply(WorldObject target)
{
}

public override ObjectTypes TargetType
{
get
{
return ObjectTypes.GameObject; // Not sure (perhaps DynamicObject)
}
}
}
}
4 changes: 4 additions & 0 deletions Services/WCell.RealmServer/Spells/SpellHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,10 @@ static void InitEffectHandlers()
SpellEffectCreators[(int)SpellEffectType.AddComboPoints] = (cast, effect) => new AddComboPointsEffectHandler(cast, effect); // 80
SpellEffectCreators[(int)SpellEffectType.Duel] = (cast, effect) => new DuelEffectHandler(cast, effect); // 83
SpellEffectCreators[(int)SpellEffectType.SummonPlayer] = (cast, effect) => new SummonPlayerEffectHandler(cast, effect); // 85
SpellEffectCreators[(int)SpellEffectType.WMODamage] = (cast, effect) => new WMODamage(cast, effect); // 87
SpellEffectCreators[(int)SpellEffectType.WMORepair] = (cast, effect) => new WMORepair(cast, effect); // 88
SpellEffectCreators[(int)SpellEffectType.WMOChange] = (cast, effect) => new WMOChange(cast, effect); // 89
SpellEffectCreators[(int)SpellEffectType.KillCreditPersonal] = (cast, effect) => new KillCreditPersonal(cast, effect); // 90
SpellEffectCreators[(int)SpellEffectType.SelfResurrect] = (cast, effect) => new SelfResurrectEffectHandler(cast, effect); // 94
SpellEffectCreators[(int)SpellEffectType.Skinning] = (cast, effect) => new SkinningEffectHandler(cast, effect); // 95
SpellEffectCreators[(int)SpellEffectType.Charge] = (cast, effect) => new ChargeEffectHandler(cast, effect); // 96
Expand Down
4 changes: 4 additions & 0 deletions Services/WCell.RealmServer/WCell.RealmServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@
<Compile Include="Spells\Auras\PeriodicallyUpdatedAuraEffectHandler.cs" />
<Compile Include="Spells\Effects\ApplyGlyph.cs" />
<Compile Include="Spells\Effects\Inebriate.cs" />
<Compile Include="Spells\Effects\KillCreditPersonal.cs" />
<Compile Include="Spells\Effects\WMOChange.cs" />
<Compile Include="Spells\Effects\WMODamage.cs" />
<Compile Include="Spells\Effects\WMORepair.cs" />
<Compile Include="Spells\Targeting\AISpellTargetCollection.cs" />
<Compile Include="ArenaTeams\ArenaTeam.cs" />
<Compile Include="ArenaTeams\ArenaTeamMember.cs" />
Expand Down

0 comments on commit ddd1168

Please sign in to comment.