public override void MessageHandle(EZUDP.MessageBuffer msg) { try { if ((Protocol)msg.ReadShort() == Protocol.MapArgument) { switch ((Protocol_CP)msg.ReadShort()) { case Protocol_CP.TeamOwner: pointList[msg.ReadByte()].SetOwner(GetTeam(msg.ReadByte())); break; case Protocol_CP.TeamProgress: pointList[msg.ReadByte()].SetProgress(msg.ReadFloat()); break; } } } catch (Exception e) { Log.Write(ConsoleColor.Yellow, "Packet corrupt!"); Log.Write(ConsoleColor.Red, e.Message); Log.Write(ConsoleColor.DarkRed, e.StackTrace); } if (msg != null) { msg.Reset(); } base.MessageHandle(msg); }
public override void MessageHandle(EZUDP.MessageBuffer msg) { try { if ((Protocol)msg.ReadShort() == Protocol.MapArgument) { switch ((Protocol_CTF)msg.ReadShort()) { case Protocol_CTF.FlagGrabbed: { CTFPlayer player = (CTFPlayer)playerList[msg.ReadByte()]; player.GrabFlag(flags[(player.Team.id + 1) % 2]); break; } case Protocol_CTF.FlagDropped: flags[msg.ReadByte()].Drop(msg.ReadVector2(), msg.ReadVector2()); break; case Protocol_CTF.FlagReturned: flags[msg.ReadByte()].Return(); break; case Protocol_CTF.FlagCaptured: FlagCaptured(flags[msg.ReadByte()]); break; case Protocol_CTF.RoundTimer: roundTimer = new Timer(msg.ReadFloat(), false); UpdateTimeText(); break; case Protocol_CTF.FlagPosition: flags[msg.ReadByte()].ReceivePosition(msg.ReadVector2(), msg.ReadVector2()); break; case Protocol_CTF.TeamScore: score[0] = msg.ReadByte(); score[1] = msg.ReadByte(); UpdateScoreText(); break; } } } catch (Exception e) { Log.Write(ConsoleColor.Yellow, "Packet corrupt!"); Log.Write(ConsoleColor.Red, e.Message); Log.Write(ConsoleColor.DarkRed, e.StackTrace); } if (msg != null) { msg.Reset(); } base.MessageHandle(msg); }
public override void MessageHandle(EZUDP.MessageBuffer msg) { try { if ((Protocol)msg.ReadShort() == Protocol.MapArgument) { switch ((Protocol_SY)msg.ReadShort()) { case Protocol_SY.PlayerScrap: (playerList[msg.ReadByte()] as SYPlayer).ReceiveScrap(msg.ReadByte()); break; case Protocol_SY.ScrapGainEffect: AddEffect(new EffectGainScrap(msg.ReadVector2(), msg.ReadShort(), this)); break; case Protocol_SY.ScrapExistance: CreateScrap(msg.ReadShort(), msg.ReadVector2(), msg.ReadVector2()); break; case Protocol_SY.ScrapCollect: { SYScrap scrap = scrapList[msg.ReadShort()]; SYPlayer player = (SYPlayer)playerList[msg.ReadByte()]; player.CollectScrap(scrap); break; } case Protocol_SY.ScrapReturn: ((SYPlayer)playerList[msg.ReadByte()]).ReturnScrap(stashList[msg.ReadByte()]); break; case Protocol_SY.StashScrapAmount: stashList[msg.ReadByte()].SetScrap(msg.ReadShort()); break; case Protocol_SY.CreepExistance: SpawnCreep((CreepType)msg.ReadByte(), msg.ReadByte(), msg.ReadVector2(), msg.ReadVector2()); break; case Protocol_SY.CreepPosition: creepList[msg.ReadByte()].ReceivePosition(msg.ReadVector2(), msg.ReadVector2()); break; case Protocol_SY.CreepHit: creepList[msg.ReadByte()].ReceiveHit(msg.ReadFloat(), msg.ReadFloat(), msg); break; case Protocol_SY.CreepDie: creepList[msg.ReadByte()].Die(msg.ReadVector2()); break; case Protocol_SY.CreepCustom: creepList[msg.ReadByte()].ReceiveCustom(msg); break; case Protocol_SY.TowerExistance: { int id = msg.ReadByte(); //SYTowerPoint stash = stashList[msg.ReadByte()] as SYTowerPoint; towerList[id] = new SYTower(id, msg.ReadByte(), msg.ReadVector2(), this); break; } case Protocol_SY.TowerRotation: towerList[msg.ReadByte()].ReceiveRotation(msg.ReadFloat()); break; case Protocol_SY.TowerTarget: towerList[msg.ReadByte()].ReceiveTarget(msg.ReadByte()); break; case Protocol_SY.TowerShoot: towerList[msg.ReadByte()].ReceiveShoot(msg.ReadVector2(), msg.ReadByte()); break; case Protocol_SY.TowerHit: towerList[msg.ReadByte()].ReceiveHit(msg.ReadFloat(), msg.ReadFloat(), msg.ReadByte(), msg.ReadVector2()); break; case Protocol_SY.TowerDie: towerList[msg.ReadByte()].ReceiveDie(); break; case Protocol_SY.BaseHit: baseList[msg.ReadByte()].ReceiveHit(msg.ReadFloat(), msg.ReadFloat(), msg.ReadByte(), msg.ReadVector2()); break; } } } catch (Exception e) { Log.Write(ConsoleColor.Yellow, "Packet corrupt!"); Log.Write(ConsoleColor.Red, e.Message); Log.Write(ConsoleColor.DarkRed, e.StackTrace); } if (msg != null) { msg.Reset(); } base.MessageHandle(msg); }