public static void HandleGuildFightJoinRequestMessage(WorldClient client, GuildFightJoinRequestMessage message) { if (client.Character.Guild == null) { return; } var taxCollector = client.Character.Guild.TaxCollectors.FirstOrDefault(x => x.GlobalId == message.taxCollectorId); if (taxCollector == null || !taxCollector.IsFighting) { return; } var fight = taxCollector.Fighter.Fight as FightPvT; if (fight == null) { return; } var result = fight.AddDefender(client.Character); if (result != FighterRefusedReasonEnum.FIGHTER_ACCEPTED) { ContextHandler.SendChallengeFightJoinRefusedMessage(client, client.Character, result); } }
public static void HandleGameRolePlayTaxCollectorFightRequestMessage(WorldClient client, GameRolePlayTaxCollectorFightRequestMessage message) { TaxCollectorNpc actor = client.Character.Map.GetActor<TaxCollectorNpc>(message.taxCollectorId); FighterRefusedReasonEnum fighterRefusedReasonEnum = client.Character.CanAttack(actor); if (fighterRefusedReasonEnum != FighterRefusedReasonEnum.FIGHTER_ACCEPTED) { ContextHandler.SendChallengeFightJoinRefusedMessage(client, client.Character, fighterRefusedReasonEnum); } FightPvT fightPvT = Singleton<FightManager>.Instance.CreatePvTFight(client.Character.Map); fightPvT.RedTeam.AddFighter(client.Character.CreateFighter(fightPvT.RedTeam)); fightPvT.BlueTeam.AddFighter(actor.CreateFighter(fightPvT.BlueTeam)); fightPvT.StartPlacement(); }
public void FightWith(Character character) { if (character.Map != Map) { return; } // only this character and his group can join the fight if (AuthorizedAgressor != null && AuthorizedAgressor != character && AuthorizedAgressor.Client.Connected) { ContextHandler.SendChallengeFightJoinRefusedMessage(character.Client, character, FighterRefusedReasonEnum.TEAM_LIMITED_BY_MAINCHARACTER); return; } var reason = character.CanAttack(this); if (reason != FighterRefusedReasonEnum.FIGHTER_ACCEPTED) { ContextHandler.SendChallengeFightJoinRefusedMessage(character.Client, character, reason); return; } Map.Leave(this); if (Map.GetBlueFightPlacement().Length < CountInitialFighters()) { character.SendServerMessage("Cannot start fight : Not enough fight placements"); return; } var fight = FightManager.Instance.CreatePvMFight(Map); var monsterFighters = CreateFighters(fight.DefendersTeam).ToArray(); fight.ChallengersTeam.AddFighter(character.CreateFighter(fight.ChallengersTeam)); foreach (var monster in monsterFighters) { fight.DefendersTeam.AddFighter(monster); } Fight = fight; fight.StartPlacement(); OnEnterFight(character); Fight.FightEnded += OnFightEnded; }
public static void HandleGameRolePlayTaxCollectorFightRequestMessage(WorldClient client, GameRolePlayTaxCollectorFightRequestMessage message) { var taxCollector = client.Character.Map.GetActor <TaxCollectorNpc>(message.taxCollectorId); var result = client.Character.CanAttack(taxCollector); if (result != FighterRefusedReasonEnum.FIGHTER_ACCEPTED) { ContextHandler.SendChallengeFightJoinRefusedMessage(client, client.Character, result); return; } var fight = FightManager.Instance.CreatePvTFight(client.Character.Map); fight.ChallengersTeam.AddFighter(client.Character.CreateFighter(fight.ChallengersTeam)); fight.DefendersTeam.AddFighter(taxCollector.CreateFighter(fight.DefendersTeam)); fight.StartPlacement(); }
public static void HandleGuildFightJoinRequestMessage(WorldClient client, GuildFightJoinRequestMessage message) { if (client.Character.Guild != null) { TaxCollectorNpc taxCollectorNpc = client.Character.Guild.TaxCollectors.FirstOrDefault((TaxCollectorNpc x) => x.GlobalId == message.taxCollectorId); if (taxCollectorNpc != null && taxCollectorNpc.IsFighting) { FightPvT fightPvT = taxCollectorNpc.Fighter.Fight as FightPvT; if (fightPvT != null) { FighterRefusedReasonEnum fighterRefusedReasonEnum = fightPvT.AddDefender(client.Character); if (fighterRefusedReasonEnum != FighterRefusedReasonEnum.FIGHTER_ACCEPTED) { ContextHandler.SendChallengeFightJoinRefusedMessage(client, client.Character, fighterRefusedReasonEnum); } } } } }