Esempio n. 1
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)));
 }
Esempio n. 2
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));
     }
 }
Esempio n. 3
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);
        }
 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);
 }
Esempio n. 5
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));
 }
Esempio n. 6
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 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 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;
     }
 }
Esempio n. 9
0
 public static void CreateGuildCommand(string value, WorldClient client)
 {
     if(!client.Character.HasGuild)
         client.Send(new GuildCreationStartedMessage());
     else
         client.Send(new GuildCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_ALREADY_IN_GUILD));
 }
Esempio n. 10
0
 public static void CreateAllianceCommand(string value, WorldClient client)
 {
     if(!client.Character.HasGuild)
         client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_REQUIREMENT_UNMET));
     if (!client.Character.HasAlliance)
         client.Send(new AllianceCreationStartedMessage());
     else if (GuildProvider.GetLeader(client.Character.GuildId).CharacterId != client.Character.Id)
         client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_REQUIREMENT_UNMET));
     else if(client.Character.HasAlliance)
         client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_ALREADY_IN_GUILD));
 }
Esempio n. 11
0
 public static void AddItemCommand(string value, WorldClient client)
 {
     client.Character.Inventory.Add(ushort.Parse(value), 1);
     client.Send(new ObtainedItemMessage(ushort.Parse(value), 1));
 }
Esempio n. 12
0
        public static void SendGuildInformationsGeneral(WorldClient client)
        {
            GuildRecord guild = GuildRecord.GetGuild(client.Character.GuildId);

            ulong expFloor = ExperienceRecord.GetExperienceForGuild((ushort)(guild.Level));

            ulong expNextFloor = ExperienceRecord.GetExperienceForGuild((ushort)(guild.Level + 1));

            client.Send(new GuildInformationsGeneralMessage(true, false,
                (byte)guild.Level, expFloor, guild.Experience, expNextFloor, 0,
                (ushort)CharacterGuildRecord.MembersCount(guild.Id),
                (ushort)GuildProvider.Instance.ConnectedMembersCount(guild.Id)));
        }
 static void Document(WorldClient client,InteractiveRecord ele)
 {
     client.Send(new DocumentReadingBeginMessage(ushort.Parse(ele.OptionalValue1)));
 }
        public static void HandleChallengeRequest(GameRolePlayPlayerFightRequestMessage message, WorldClient client)
        {
            if (client.Character.Map != null && client.Character.Map.HaveZaap)
            {
                client.Character.Reply("Action impossible sur cette carte.");
                return;
            }
            WorldClient target = WorldServer.Instance.GetOnlineClient((int)message.targetId);
            if (target.Character.Busy)
            {
                client.Character.Reply("Impossible car le joueur est occupé.");
                return;
            }
            if (message.friendly)
            {

                FightDual fight = FightProvider.Instance.CreateDualFight(client.Character.Map, client.Character.Record.CellId, message.targetCellId);
                fight.InitiatorId = client.Character.Id;
                fight.AcceptorId = target.Character.Id;
                Message sMessage = new GameRolePlayPlayerFightFriendlyRequestedMessage(fight.Id, (uint)client.Character.Id, message.targetId);
                client.Send(sMessage);
                target.Send(sMessage);
            }
        }
Esempio n. 15
0
 public static void SrambadCommand(string value, WorldClient client)
 {
     client.Send(new CinematicMessage(12));
     client.Character.Teleport(138674176, 338);
     client.Character.ShowNotification("Bienvenu a srambad, cette zone est en cours de debug...");
 }
Esempio n. 16
0
 public static void SendArenaUpdatePlayerInfos(WorldClient client, ushort rank, ushort bestDailyRank, ushort bestRank, ushort victoryCount, ushort arenaFightcount)
 {
     client.Send(new GameRolePlayArenaUpdatePlayerInfosMessage(rank, bestDailyRank, bestRank, victoryCount, arenaFightcount));
 }
Esempio n. 17
0
 public override void ShowFightResults(List<FightResultListEntry> results, WorldClient client)
 {
     client.Send(new GameFightEndMessage((ushort)TimeLine.m_round, 0, 0, results, new NamedPartyTeamWithOutcome[0]));
 }
Esempio n. 18
0
 public static void HandleArenaUnregister(GameRolePlayArenaUnregisterMessage message, WorldClient client)
 {
     ArenaProvider.Instance.Unregister(client);
     client.Send(new GameRolePlayArenaRegistrationStatusMessage(false, (sbyte)PvpArenaStepEnum.ARENA_STEP_UNREGISTER, 0));
 }
        static void Zaapi(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 cost = new List<ushort>();
            var tptype = new List<sbyte>();
            foreach (InteractiveRecord interactive in InteractiveRecord.GetInteractivesByActionType("Zaapi"))
            {
                if (interactive.OptionalValue1 == ele.OptionalValue1)
                {
                    maps.Add(interactive.MapId);
                    subareas.Add(MapRecord.GetSubAreaId(interactive.MapId));
                    cost.Add(ZaapiCost);
                    tptype.Add(0);
                }
            }
            client.Send(new TeleportDestinationsListMessage((sbyte)TeleporterTypeEnum.TELEPORTER_SUBWAY, maps, subareas, cost, tptype));
        }
Esempio n. 20
0
 public static void SendGuildInformationsMembers(WorldClient client)
 {
     var members = CharacterGuildRecord.GetMembers(client.Character.GuildId);
     client.Send(new GuildInformationsMembersMessage(
                members));
 }
Esempio n. 21
0
 public static void DisableObsCommand(string value, WorldClient client)
 {
     var obstacles = new List<MapObstacle>();
     for (ushort i = 0; i < 560; i++)
     {
         obstacles.Add(new MapObstacle(i, 1));
     }
     client.Send(new MapObstacleUpdateMessage(obstacles));
 }
Esempio n. 22
0
 public static void WalkableCommand(string value, WorldClient client)
 {
     client.Send(new DebugHighlightCellsMessage(Color.BurlyWood.ToArgb(), client.Character.Map.WalkableCells.ConvertAll<ushort>(x => (ushort)x)));
 }
Esempio n. 23
0
 public static void ElementsCommand(string value, WorldClient client)
 {
     Color[] Colors = new Color[] { Color.Blue, Color.Cyan, Color.Yellow, Color.Pink, Color.Goldenrod, Color.Green, Color.Red, Color.Purple, Color.Silver, Color.SkyBlue, Color.Black };
     MapElementRecord[] elements = MapElementRecord.GetMapElementByMap(client.Character.Map.Id).ToArray();
     if (elements.Count() == 0)
     {
         client.Character.Reply("No Elements on Map...");
         return;
     }
     for (int i = 0; i < elements.Count(); i++)
     {
         var ele = elements[i];
         client.Send(new DebugHighlightCellsMessage(Colors[i].ToArgb(), new ushort[] { ele.CellId }));
         client.Character.Reply("Element > " + ele.ElementId + " CellId > " + ele.CellId, Colors[i]);
     }
 }
Esempio n. 24
0
 public static void HandleGetAllianceInformations(AllianceInsiderInfoRequestMessage message, WorldClient client)
 {
     AllianceRecord Alliance = client.Character.GetAlliance();
     AllianceInsiderInfoMessage msg = AllianceProvider.GetAllianceInsiderInfoMessage(Alliance);
     client.Send(msg);
 }
Esempio n. 25
0
 public static void TokenCommand(string value,WorldClient client)
 {
     uint quantity = uint.Parse(value);
     client.Character.Inventory.Add(ConstantsRepertory.TOKEN_ID, quantity);
     client.Send(new ObtainedItemMessage(ConstantsRepertory.TOKEN_ID,quantity ));
 }
 static bool Book(WorldClient client, ObjectEffect effect, uint uid)
 {
     ObjectEffectInteger integer = effect as ObjectEffectInteger;
     client.Send(new DocumentReadingBeginMessage(integer.value));
     return false;
 }
Esempio n. 27
0
 static void Cinematic(WorldClient client,NpcReplyRecord reply)
 {
     client.Send(new CinematicMessage(ushort.Parse(reply.OptionalValue1)));
 }
        public static void HandleStatsUpgrade(StatsUpgradeRequestMessage message, WorldClient client)
        {
            if (client.Character.IsFighting)
            {
                client.Send(new StatsUpgradeResultMessage((sbyte)StatsUpgradeResultEnum.IN_FIGHT, 0));
                return;
            }
            StatsBoostTypeEnum statId = (StatsBoostTypeEnum)message.statId;
            if (statId < StatsBoostTypeEnum.Strength || statId > StatsBoostTypeEnum.Intelligence)
            {
                Logger.Error("Wrong statsid");
            }
            if (message.boostPoint > 0)
            {
                UInt16ReflectedStat linkedStat = GetReflectedStat(client.Character.StatsRecord,statId);

                BreedRecord breed = BreedRecord.GetBreed(client.Character.Record.Breed);
                int num = linkedStat.GetValue();
                ushort num2 = message.boostPoint;
                if (num2 >= 1 && message.boostPoint <= (short)client.Character.Record.StatsPoints)
                {
                    uint[][] thresholds = breed.GetThresholds(statId);
                    int thresholdIndex = breed.GetThresholdIndex(num, thresholds);
                    while ((long)num2 >= (long)((ulong)thresholds[thresholdIndex][1]))
                    {
                        short num3;
                        short num4;
                        if (thresholdIndex < thresholds.Length - 1 && (double)num2 / thresholds[thresholdIndex][1] > (double)((ulong)thresholds[thresholdIndex + 1][0] - (ulong)((long)num)))
                        {
                            num3 = (short)((ulong)thresholds[thresholdIndex + 1][0] - (ulong)((long)num));
                            num4 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][1]));
                            if (thresholds[thresholdIndex].Length > 2)
                            {
                                num3 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][2]));
                            }
                        }
                        else
                        {
                            num3 = (short)System.Math.Floor((double)num2 / thresholds[thresholdIndex][1]);
                            num4 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][1]));
                            if (thresholds[thresholdIndex].Length > 2)
                            {
                                num3 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][2]));
                            }
                        }
                        num += (int)num3;
                        num2 -= (ushort)num4;
                        thresholdIndex = breed.GetThresholdIndex(num, thresholds);
                    }

                    if (statId == StatsBoostTypeEnum.Vitality)
                    {
                        var previousVitality = linkedStat.GetValue();
                        linkedStat.SetValue((short)num);
                        client.Character.StatsRecord.LifePoints += (short)(client.Character.StatsRecord.BaseVitality - previousVitality);
                        client.Character.CurrentStats.LifePoints += (uint)(client.Character.StatsRecord.BaseVitality - previousVitality);
                    }
                    else
                    {
                        linkedStat.SetValue((short)num);
                    }
                    client.Character.Record.StatsPoints -= (ushort)(message.boostPoint - num2);
                    client.Send(new StatsUpgradeResultMessage((sbyte)StatsUpgradeResultEnum.SUCCESS, message.boostPoint));
                    client.Character.RefreshStats();

                }
            }
        }
 public static void HandleShortcutBarRemove(ShortcutBarRemoveRequestMessage message, WorldClient client)
 {
     switch ((ShortcutBarEnum)message.barType)
     {
         case ShortcutBarEnum.GENERAL_SHORTCUT_BAR:
             GeneralShortcutRecord.RemoveShortcut(client.Character.Id, message.slot);
             break;
         case ShortcutBarEnum.SPELL_SHORTCUT_BAR:
             SpellShortcutRecord.RemoveShortcut(client.Character.Id, message.slot);
             break;
     }
     client.Send(new ShortcutBarRemovedMessage(message.barType, message.slot));
 }
        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));
        }