public static bool HandleEffects(WorldClient client, CharacterItemRecord item)
 {
     bool remove = false;
     if (!ConditionProvider.ParseAndEvaluate(client,item.GetTemplate().Criteria))
     {
         client.Character.Reply("Vous ne possédez pas les critères nécessaires pour utiliser cet objet.");
         return remove;
     }
     var effects = item.GetEffects();
     foreach (var effect in effects)
     {
         var function = Functions.ToList().Find(x => x.Key == (EffectsEnum)effect.actionId);
         if (function.Value != null)
         {
             try
             {
                 if (function.Value(client, effect, item.UID))
                     remove = true;
             }
             catch (Exception ex)
             {
                 client.Character.NotificationError(ex.Message);
             }
         }
         else
         {
             client.Character.NotificationError((EffectsEnum)effect.actionId + " is not handled");
         }
     }
     return remove;
 }
        public static void HandleAttackRequest(GameRolePlayAttackMonsterRequestMessage message, WorldClient client)
        {
            if (client.Character.Map == null)
                return;
            if (client.Character.CancelMonsterAgression)
            {
                client.Character.CancelMonsterAgression = false;
                return;
            }
            if (!client.Character.Map.IsValid())
            {
                client.Character.Reply("Unable to start placement,this map is not valid");
                return;
            }
            var group = client.Character.Map.Instance.GetMapMonsterGroup(message.monsterGroupId);
            if (group != null)
            {
                FightPvM fight = FightProvider.Instance.CreatePvMFight(group, client.Character.Map, (short)group.CellId);

                fight.BlueTeam.AddFighter(client.Character.CreateFighter(fight.BlueTeam)); // on ajoute le perso

                group.Monsters.ForEach(x => fight.RedTeam.AddFighter(x.CreateFighter(fight.RedTeam))); // on ajoute les monstres

                fight.StartPlacement();
            }
            else
            {
                client.Character.NotificationError("Unable to fight, MonsterGroup dosent exist...");
            }
        }
 public void Dispose()
 {
     this.Recruter.Character.GuildInvitationDialog = null;
     this.Recruted.Character.GuildInvitationDialog = null;
     this.Recruted = null;
     this.Recruter = null;
 }
        public static void HandleShortcutBarAdd(ShortcutBarAddRequestMessage message, WorldClient client)
        {
            switch ((ShortcutBarEnum)message.barType)
            {
                case ShortcutBarEnum.GENERAL_SHORTCUT_BAR:
                    if (message.shortcut is ShortcutObjectItem)
                    {
                        ShortcutObjectItem shortcutObj = (ShortcutObjectItem)message.shortcut;
                        GeneralShortcutRecord.AddShortcut(client.Character.Id, shortcutObj.slot, ShortcutObjectItem.Id, shortcutObj.itemUID, shortcutObj.itemGID);
                    }
                    if (message.shortcut is ShortcutSmiley)
                    {
                        ShortcutSmiley shortcutSmiley = (ShortcutSmiley)message.shortcut;
                        GeneralShortcutRecord.AddShortcut(client.Character.Id, shortcutSmiley.slot, ShortcutSmiley.Id, shortcutSmiley.smileyId, 0);
                    }
                    if (message.shortcut is ShortcutEmote)
                    {
                        ShortcutEmote shortcutEmote = (ShortcutEmote)message.shortcut;
                        GeneralShortcutRecord.AddShortcut(client.Character.Id, shortcutEmote.slot, ShortcutEmote.Id, shortcutEmote.emoteId, 0);
                    }
                    break;

                case ShortcutBarEnum.SPELL_SHORTCUT_BAR:
                    ShortcutSpell shortcut = (ShortcutSpell)message.shortcut;
                    SpellShortcutRecord.AddShortcut(client.Character.Id, shortcut.slot, shortcut.spellId);
                    break;
            }
            client.Character.RefreshShortcuts();
        }
示例#5
0
 public static void HandleAllianceKickRequest(AllianceKickRequestMessage message, WorldClient client)
 {
     if(client.Character.HasAlliance && AllianceProvider.GetLeader(client.Character.AllianceId).Id == client.Character.GuildId && GuildProvider.GetLeader(client.Character.GuildId).CharacterId == client.Character.Id)
     {
         AllianceRecord.GetAlliance(client.Character.AllianceId).KickFromAlliance((int)message.kickedId, client);
     }
 }
示例#6
0
 public override bool Eval(WorldClient client)
 {
     if (client.Character.Record.Breed == sbyte.Parse(ConditionValue))
         return true;
     else
         return false;
 }
示例#7
0
 public static void HandlePartyInvitationDungeonRequest(PartyInvitationDungeonRequestMessage message, WorldClient client)
 {
     WorldClient target = WorldServer.Instance.GetOnlineClient(message.name);
     Party p;
     if (client.Character.PartyMember == null)
     {
         WorldServer.Instance.Parties.OrderBy(x => x.Id);
         int partyId = 0;
         if (WorldServer.Instance.Parties.Count > 0)
         {
             partyId = WorldServer.Instance.Parties.Last().Id + 1;
         }
         else
         {
             partyId = 1;
         }
         p = new Party(partyId, client.Character.Id, "");
     }
     else
     {
         p = WorldServer.Instance.Parties.Find(x => x.Id == client.Character.PartyMember.Party.Id);
     }
     if (p == null)
         return;
     p.SetName(DungeonsIdRecord.DungeonsId.Find(x => x.Id == message.dungeonId).Name, client);
     p.CreateInvitation(client, target, PartyTypeEnum.PARTY_TYPE_DUNGEON, message.dungeonId);
     if (p.Members.Count == 0)
     {
         p.BossCharacterId = client.Character.Id;
         p.NewMember(client);
     }
 }
        public static void HandleChallengeAnswer(GameRolePlayPlayerFightFriendlyAnswerMessage message, WorldClient client)
        {
            if (client.Character.IsFighting)
                return;
            FightDual fight = FightProvider.Instance.GetFight(message.fightId) as FightDual;
            var sMessage = new GameRolePlayPlayerFightFriendlyAnsweredMessage(message.fightId, (uint)client.Character.Id, (uint)fight.InitiatorId, false);

            if (client.Character.Id == fight.InitiatorId)
            {
                var acceptor = WorldServer.Instance.GetOnlineClient(fight.AcceptorId);
                acceptor.Send(sMessage);
                return;
            }
            WorldClient target = WorldServer.Instance.GetOnlineClient((fight.InitiatorId));
            if (message.accept)
            {

                sMessage.accept = true;
                target.Send(sMessage);
                fight.BlueTeam.AddFighter(client.Character.CreateFighter(fight.BlueTeam));
                fight.RedTeam.AddFighter(target.Character.CreateFighter(fight.RedTeam));
                fight.StartPlacement();
            }
            else
            {
                target.Send(sMessage);
                FightProvider.Instance.RemoveFight(message.fightId);
            }
        }
 public GuildInvitationDialog(WorldClient recruter, WorldClient recruted)
 {
     this.Recruter = recruter;
     this.Recruted = recruted;
     this.Recruter.Character.GuildInvitationDialog = this;
     this.Recruted.Character.GuildInvitationDialog = this;
 }
示例#10
0
        public static void HandleAllianceCreationRequest(AllianceCreationValidMessage message, WorldClient client)
        {
            if (!AllianceProvider.CanCreateAlliance(client, message))
                return;

            client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_OK));
            AllianceProvider.CreateAlliance(client.Character.GetGuild(), message.allianceTag, message.allianceName, message.allianceEmblem);
        }
示例#11
0
 public override bool Eval(WorldClient client)
 {
     if (client.Character.HasGuild)
     {
         return true;
     }
     return false;
 }
示例#12
0
 public static void HandleObjectUseMultiple(ObjectUseMultipleMessage message, WorldClient client)
 {
     var item = client.Character.Inventory.GetItem(message.objectUID);
     for (int i = 0; i < message.quantity; i++)
     {
         ItemUseEffectsProvider.HandleEffects(client, item);
     }
     client.Character.Inventory.RemoveItem(item.UID, message.quantity);
 }
示例#13
0
 public PlayerTradeExchange(WorldClient client, WorldClient target)
 {
     this.Client = client;
     this.SecondTrader = target;
     this.SecondTrader.Character.CurrentDialogType = DialogTypeEnum.DIALOG_EXCHANGE;
     this.Client.Character.CurrentDialogType = DialogTypeEnum.DIALOG_EXCHANGE;
     this.Client.Character.ExchangeType = ExchangeType;
     this.SecondTrader.Character.ExchangeType = ExchangeType;
 }
示例#14
0
 public static void HandleDungeonPartyFinder(DungeonPartyFinderAvailableDungeonsRequestMessage message, WorldClient client)
 {
     List<DungeonsIdRecord> record = DungeonsIdRecord.DungeonsId;
     List<ushort> ids = new List<ushort>();
     foreach(DungeonsIdRecord dj in record)
     {
         ids.Add((ushort)dj.Id);
     }
     client.Send(new DungeonPartyFinderAvailableDungeonsMessage((IEnumerable<ushort>)ids));
 }
示例#15
0
        public Character(CharacterRecord record, WorldClient client)
        {
            this.Client = client;
            this.Record = record;
            this.Look = ContextActorLook.Parse(Record.Look);
            this.HumanOptions = new List<HumanOption>();

            this.Inventory = new Inventory(this);

            this.PlayerStatus = new PlayerStatus((sbyte)PlayerStatusEnum.PLAYER_STATUS_AVAILABLE);
        }
示例#16
0
 public static void HandleGuildChangeMemberParameters(GuildChangeMemberParametersMessage message, WorldClient client)
 {
     CharacterGuildRecord member = CharacterGuildRecord.GetCharacterGuild((int)message.memberId);
     member.ChangeParameters(client, message.rank, message.experienceGivenPercent, message.rights);
     SendGuildInformationsMembers(client);
     if (WorldServer.Instance.IsConnected(member.CharacterId))
     {
         WorldClient c = WorldServer.Instance.GetOnlineClient(member.CharacterId);
         c.Send(new GuildMembershipMessage(c.Character.GetGuild().GetGuildInformations(),message.rights,true));
     }
 }
示例#17
0
 public static void HandleDungeonPartyFinderRegister(DungeonPartyFinderRegisterRequestMessage message, WorldClient client)
 {
     if (DungeonPartyProvider.Instance.GetDPCByCharacterId(client.Character.Id) != null)
     {
         DungeonPartyProvider.Instance.UpdateCharacter(client.Character, message.dungeonIds.ToList());
     }
     else
     {
         DungeonPartyProvider.Instance.AddCharacter(client.Character, message.dungeonIds.ToList());
     }
     client.Send(new DungeonPartyFinderRegisterSuccessMessage((IEnumerable<ushort>)message.dungeonIds));
 }
 public static void HandleLeaveDialog(LeaveDialogRequestMessage message, WorldClient client)
 {
     if (client.Character.CurrentDialogType == DialogTypeEnum.DIALOG_EXCHANGE)
     {
         client.Character.LeaveExchange();
     }
     if (client.Character.CurrentDialogType != null)
     {
         client.Send(new LeaveDialogMessage((sbyte)client.Character.CurrentDialogType));
         client.Character.CurrentDialogType = null;
     }
 }
 public static void HandePlayerStatusChangeRequest(PlayerStatusUpdateRequestMessage message, WorldClient client)
 {
     client.Character.PlayerStatus = message.status;
     if((PlayerStatusEnum)message.status.statusId == PlayerStatusEnum.PLAYER_STATUS_AFK || (PlayerStatusEnum)message.status.statusId == PlayerStatusEnum.PLAYER_STATUS_PRIVATE || (PlayerStatusEnum)message.status.statusId == PlayerStatusEnum.PLAYER_STATUS_SOLO)
     {
         if(DungeonPartyProvider.Instance.GetDPCByCharacterId(client.Character.Id) != null)
         {
             DungeonPartyProvider.Instance.RemoveCharacter(client.Character);
         }
     }
     client.Send(new PlayerStatusUpdateMessage(client.Character.Record.AccountId, (uint)client.Character.Id, message.status));
 }
 public static void HandleFriendJoin(FriendJoinRequestMessage message,WorldClient client)
 {
     WorldClient target = WorldServer.Instance.GetOnlineClient(message.name);
     if (target != null)
     {
         client.Character.Teleport(target.Character.Record.MapId, target.Character.Record.CellId);
         client.Character.Reply("Vous avez été téléporté a " + message.name);
     }
     else
     {
         client.Character.Reply("Le personnage n'éxiste pas ou n'est pas connécté.");
     }
 }
示例#21
0
 public static void HandleArenaAnswer(GameRolePlayArenaFightAnswerMessage message, WorldClient client)
 {
     if (client.Character.IsFighting)
     {
         client.Character.ReplyError("Impossible de répondre au kolizeum en combat, le combat a été annulé.");
         message.accept = false;
     }
     if (client.Character.Map != null && client.Character.Map.DugeonMap)
     {
         client.Character.ReplyError("Impossible de répondre au kolizeum en donjon.");
         message.accept = false;
     }
     ArenaProvider.Instance.Answer(client, message.accept);
 }
示例#22
0
 public static void HandleGetGuildInFactRequest(GuildFactsRequestMessage message, WorldClient client)
 {
     GuildRecord guild = GuildRecord.GetGuild((int)message.guildId);
     if (guild == null)
         return;
     AllianceRecord alliance = AllianceProvider.GetAllianceFromGuild(guild.Id);
     List<CharacterMinimalInformations> membersMinimalInfos = new List<CharacterMinimalInformations>();
     foreach (GuildMember member in CharacterGuildRecord.GetMembers(guild.Id))
     {
         membersMinimalInfos.Add(new CharacterMinimalInformations(member.id, member.level, member.name));
     }
     if (alliance == null)
         client.Send(new GuildFactsMessage(new GuildFactSheetInformations((uint)guild.Id, guild.Name, guild.GetEmblemObject(), (uint)GuildProvider.GetLeader(guild.Id).CharacterId, (byte)guild.Level, (ushort)CharacterGuildRecord.GetMembers(guild.Id).Count()), 0, 0, true, (IEnumerable<CharacterMinimalInformations>)membersMinimalInfos));
     else
         client.Send(new GuildInAllianceFactsMessage(new GuildFactSheetInformations((uint)guild.Id, guild.Name, guild.GetEmblemObject(), (uint)GuildProvider.GetLeader(guild.Id).CharacterId, (byte)guild.Level, (ushort)CharacterGuildRecord.GetMembers(guild.Id).Count()),0,0,true, (IEnumerable<CharacterMinimalInformations>)membersMinimalInfos,new BasicNamedAllianceInformations((uint)alliance.Id,alliance.Tag,alliance.Name)));
 }
示例#23
0
 public static void Handle(WorldClient client, List<NpcReplyRecord> records)
 {
     if (records.Count == 0)
     {
         client.Character.NotificationError("No Reply action finded for this npc...");
         return;
     }
     foreach (var record in records)
     {
         var handler = NpcReplyActions.FirstOrDefault(x => x.Key == record.ActionType);
         if (handler.Value != null)
             handler.Value(client, record);
         else
             client.Character.Reply("No reply action finded for this npc... with action " + record.ActionType);
     }
 }
示例#24
0
 public static void HandleObjectUse(ObjectUseMessage message, WorldClient client)
 {
     var item = client.Character.Inventory.GetItem(message.objectUID);
     if (item != null)
     {
         if (CustomObjectUseHandler.CustomHandlerExist(item.GID))
         {
             CustomObjectUseHandler.Handle(client, item);
             client.Character.RefreshShortcuts();
             return;
         }
         if (ItemUseEffectsProvider.HandleEffects(client, item))
             client.Character.Inventory.RemoveItem(item.UID, 1);
         client.Character.RefreshShortcuts();
     }
 }
示例#25
0
 public static void HandleGuildCreationRequest(GuildCreationValidMessage message, WorldClient client)
 {
     if (GuildProvider.Instance.HasGuild(client.Character.Id))
     {
         client.Send(new GuildCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_ALREADY_IN_GUILD));
         return;
     }
     if (GuildRecord.CanCreateGuild(message.guildName))
     {
         GuildRecord newGuild = GuildProvider.Instance.CreateGuild(client.Character, message);
         client.Send(new GuildCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_OK));
     }
     else
     {
         client.Send(new GuildCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_NAME_ALREADY_EXISTS));
     }
 }
 public static void Handle(WorldClient client,InteractiveRecord ele)
 {
     var interaction = InteractiveActionsManager.FirstOrDefault(x => x.Key ==ele.ActionType.ToLower());
     if (interaction.Value != null)
     {
         client.Send(new InteractiveUsedMessage((uint)client.Character.Id,(uint) ele.ElementId,(ushort)ele.SkillId,30));
         client.Send(new InteractiveUseEndedMessage((uint)ele.ElementId,(ushort) ele.SkillId));
         try
         {
             interaction.Value(client, ele);
         }
         catch (Exception ex)
         {
             client.Character.NotificationError( ele.ActionType + ": " + ex.Message);
         }
     }
     else
         client.Character.Reply("[Interactives] Unable to handle (" +ele.ActionType + ")",System.Drawing.Color.Red);
 }
示例#27
0
 public static List<NpcReplyRecord> GetPossibleReply(WorldClient client, List<NpcReplyRecord> replies)
 {
     List<NpcReplyRecord> results = new List<NpcReplyRecord>();
     foreach (var reply in replies)
     {
         if (results.Find(x => x.ReplyId == reply.ReplyId) == null)
         {
             if (Conditions.ConditionProvider.ParseAndEvaluate(client, reply.Condition))
             {
                 results.Add(reply);
             }
             else
             {
                 if (reply.ConditionExplanation != null && reply.ConditionExplanation != string.Empty)
                 {
                     client.Character.ShowNotification("Critère: "+reply.ConditionExplanation);
                 }
             }
         }
     }
     return results;
 }
        public static void Zaap(WorldClient client,InteractiveRecord ele)
        {
            if (client.Character.CurrentDialogType == DialogTypeEnum.DIALOG_TELEPORTER)
                return;
            client.Character.CurrentDialogType = DialogTypeEnum.DIALOG_TELEPORTER;
            var maps = new List<int>();
            var subareas = new List<ushort>();
            var costs = new List<ushort>();
            var tptype = new List<sbyte>();
            foreach (InteractiveRecord interactive in InteractiveRecord.GetInteractivesByActionType("Zaap"))
            {
                if (interactive.OptionalValue1 == ele.OptionalValue1)
                {
                    maps.Add(interactive.MapId);
                    subareas.Add(MapRecord.GetSubAreaId(interactive.MapId));
                    costs.Add(ZaapCost);
                    tptype.Add((sbyte)TeleporterTypeEnum.TELEPORTER_ZAAP);
                }

            }
            client.Send(new ZaapListMessage((sbyte)TeleporterTypeEnum.TELEPORTER_ZAAP, maps, subareas, costs, tptype,client.Character.Record.SpawnPointMapId));
        }
示例#29
0
 public static bool ParseAndEvaluate(WorldClient client,string conditions)
 {
     foreach (var condition in conditions.Split('&'))
     {
         if (condition == null || condition == string.Empty)
             return true;
         string conditionIndentifier = new string(condition.Take(2).ToArray());
         var conditionHandler = ConditionsTypes.FirstOrDefault(x => x.Key == conditionIndentifier);
         if (conditionHandler.Value != null)
         {
             var conditionObj = Activator.CreateInstance(conditionHandler.Value) as Condition;
             conditionObj.ConditionFull = condition;
             if (!conditionObj.Eval(client))
                 return false;
         }
         else
         {
             client.Character.ShowNotification("Unknown condition indentifier: " + conditionIndentifier + ". Skeeping condition");
             return true;
         }
     }
     return true;
 }
示例#30
0
 public static void HandleArenaRegister(GameRolePlayArenaRegisterMessage message, WorldClient client)
 {
     if (client.Character.Map == null)
     {
         client.Character.ReplyError("Impossible de s'inscrire au kolizeum actuellement.");
         return;
     }
     if (client.Character.Map.DugeonMap)
     {
         client.Character.ReplyError("Impossible de s'inscrire au kolizeum en donjon.");
         return;
     }
     if (client.Character.IsFighting)
     {
         client.Character.ReplyError("Impossible de s'inscrire au kolizeum en combat");
         return;
     }
     if (client.Character.Record.Level < ArenaProvider.MINIMUM_LEVEL_TO_SEARCH_ARENA)
     {
         client.Character.ReplyError("Vous devez être au moins niveau " + ArenaProvider.MINIMUM_LEVEL_TO_SEARCH_ARENA + " pour vous inscrire en kolizeum.");
         return;
     }
     ArenaProvider.Instance.SearchArena(client);
 }