Commit e0facc91 authored by mercury233's avatar mercury233

zones use enum constants

parent 40a5021b
namespace WindBot.Game.AI
{
public enum Zones
{
z0 = 0x1,
z1 = 0x2,
z2 = 0x4,
z3 = 0x8,
z4 = 0x10,
z5 = 0x20,
z6 = 0x40,
MonsterZones = 0x7f,
MainMonsterZones = 0x1f,
ExtraMonsterZones = 0x60,
SpellZones = 0x1f,
PendulumZones = 0x3,
LinkedZones = 0x10000,
NotLinkedZones = 0x20000
}
}
\ No newline at end of file
...@@ -1016,60 +1016,63 @@ namespace WindBot.Game ...@@ -1016,60 +1016,63 @@ namespace WindBot.Game
bool pendulumZone = false; bool pendulumZone = false;
byte LOCATION_MZONE = 0x4;
byte LOCATION_SZONE = 0x8;
int filter; int filter;
if ((field & 0x7f) != 0) if ((field & 0x7f) != 0)
{ {
resp[0] = (byte)GetLocalPlayer(0); resp[0] = (byte)GetLocalPlayer(0);
resp[1] = 0x4; resp[1] = LOCATION_MZONE;
filter = field & 0x7f; filter = field & (int)Zones.MonsterZones;
} }
else if ((field & 0x1f00) != 0) else if ((field & 0x1f00) != 0)
{ {
resp[0] = (byte)GetLocalPlayer(0); resp[0] = (byte)GetLocalPlayer(0);
resp[1] = 0x8; resp[1] = LOCATION_SZONE;
filter = (field >> 8) & 0x1f; filter = (field >> 8) & (int)Zones.SpellZones;
} }
else if ((field & 0xc000) != 0) else if ((field & 0xc000) != 0)
{ {
resp[0] = (byte)GetLocalPlayer(0); resp[0] = (byte)GetLocalPlayer(0);
resp[1] = 0x8; resp[1] = LOCATION_SZONE;
filter = (field >> 14) & 0x3; filter = (field >> 14) & (int)Zones.PendulumZones;
pendulumZone = true; pendulumZone = true;
} }
else if ((field & 0x7f0000) != 0) else if ((field & 0x7f0000) != 0)
{ {
resp[0] = (byte)GetLocalPlayer(1); resp[0] = (byte)GetLocalPlayer(1);
resp[1] = 0x4; resp[1] = LOCATION_MZONE;
filter = (field >> 16) & 0x7f; filter = (field >> 16) & (int)Zones.MonsterZones;
} }
else if ((field & 0x1f000000) != 0) else if ((field & 0x1f000000) != 0)
{ {
resp[0] = (byte) GetLocalPlayer(1); resp[0] = (byte) GetLocalPlayer(1);
resp[1] = 0x8; resp[1] = LOCATION_SZONE;
filter = (field >> 24) & 0x1f; filter = (field >> 24) & (int)Zones.SpellZones;
} }
else else
{ {
resp[0] = (byte) GetLocalPlayer(1); resp[0] = (byte) GetLocalPlayer(1);
resp[1] = 0x8; resp[1] = LOCATION_SZONE;
filter = (field >> 30) & 0x3; filter = (field >> 30) & (int)Zones.PendulumZones;
pendulumZone = true; pendulumZone = true;
} }
if (!pendulumZone) if (!pendulumZone)
{ {
if ((filter & 0x40) != 0) resp[2] = 6; if ((filter & (int)Zones.z6) != 0) resp[2] = 6;
else if ((filter & 0x20) != 0) resp[2] = 5; else if ((filter & (int)Zones.z5) != 0) resp[2] = 5;
else if ((filter & 0x4) != 0) resp[2] = 2; else if ((filter & (int)Zones.z2) != 0) resp[2] = 2;
else if ((filter & 0x2) != 0) resp[2] = 1; else if ((filter & (int)Zones.z1) != 0) resp[2] = 1;
else if ((filter & 0x8) != 0) resp[2] = 3; else if ((filter & (int)Zones.z3) != 0) resp[2] = 3;
else if ((filter & 0x1) != 0) resp[2] = 0; else if ((filter & (int)Zones.z0) != 0) resp[2] = 0;
else if ((filter & 0x10) != 0) resp[2] = 4; else if ((filter & (int)Zones.z4) != 0) resp[2] = 4;
} }
else else
{ {
if ((filter & 0x1) != 0) resp[2] = 6; if ((filter & (int)Zones.z0) != 0) resp[2] = 6;
if ((filter & 0x2) != 0) resp[2] = 7; if ((filter & (int)Zones.z1) != 0) resp[2] = 7;
} }
BinaryWriter reply = GamePacketFactory.Create(CtosMessage.Response); BinaryWriter reply = GamePacketFactory.Create(CtosMessage.Response);
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
<Compile Include="Game\AI\Enums\InvincibleMonster.cs" /> <Compile Include="Game\AI\Enums\InvincibleMonster.cs" />
<Compile Include="Game\AI\Enums\Floodgate.cs" /> <Compile Include="Game\AI\Enums\Floodgate.cs" />
<Compile Include="Game\AI\Executor.cs" /> <Compile Include="Game\AI\Executor.cs" />
<Compile Include="Game\AI\Zones.cs" />
<Compile Include="Game\AI\ExecutorType.cs" /> <Compile Include="Game\AI\ExecutorType.cs" />
<Compile Include="Game\BattlePhase.cs" /> <Compile Include="Game\BattlePhase.cs" />
<Compile Include="Game\BattlePhaseAction.cs" /> <Compile Include="Game\BattlePhaseAction.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment