Exemple #1
0
        private void KickInviteHandler(List <object> objects)
        {
            Party controlledCharacterParty = Game.Zone.Parties.FirstOrDefault(party => party.Members.Contains(Game.Player.Character));

            if (controlledCharacterParty == null)
            {
                Debug.ThrowException(new Exception("cannot kick invite without party"));
            }

            if (controlledCharacterParty.Leader != Game.Player.Character)
            {
                Debug.ThrowException(new Exception("can only kick invite if leader"));
            }

            Party invitedPartyToKick = Game.Zone.Parties.FirstOrDefault(party => IdManager.GetId(party) == (ushort)objects[1]);

            if (invitedPartyToKick == null)
            {
                Debug.ThrowException(new Exception("party to kick does not exist"));
            }

            GameLogic.PartyKickInvite(invitedPartyToKick);
        }
Exemple #2
0
        private void UnEquipBag(Bag bag, InventoryPage targetPage, byte targetSlot)
        {
            Debug.Requires(bag != null);
            Debug.Requires(targetPage != null);
            Debug.Requires(targetSlot < targetPage.Size);
            Debug.Requires(bag != targetPage);
            Debug.Requires(InventoryPage.Items.All(entry => entry.Value.Key != bag));

            byte bagSlot;

            if (!TryGetBagSlot(bag, out bagSlot))
            {
                Debug.ThrowException(new ArgumentException("bag not equipped"));
            }

            _bags[bagSlot] = null;

            targetPage.PutItem(bag.Bag, targetSlot);

            if (Game.State == GameState.Playing)
            {
                Network.GameServer.Send(GameServerMessage.UnEquipBag, (ushort)1, IdManager.GetId(bag.Bag), IdManager.GetId(targetPage), targetSlot);
            }
        }
 private void RefreshAppearance()
 {
     Network.GameServer.Send(GameServerMessage.RefreshAgentAppearance, IdManager.GetId(this));
 }
Exemple #4
0
 internal void Remove()
 {
     Network.GameServer.Send(GameServerMessage.SkillEffectRemove,
                             IdManager.GetId(Creature),
                             Id);
 }
Exemple #5
0
 public static void OpenWindow(Window window, uint data)
 {
         Network.GameServer.Send(GameServerMessage.OpenWindow, IdManager.GetId(Player.Character), (byte) window, data);
 }
        private void InviteHandler(List <object> objects)
        {
            Party controlledCharacterParty = Game.Zone.Parties.FirstOrDefault(party => party.Members.Contains(Game.Player.Character));

            if (controlledCharacterParty == null)
            {
                Debug.ThrowException(new Exception("cannot invite without party"));
            }

            if (controlledCharacterParty.Leader != Game.Player.Character)
            {
                Debug.ThrowException(new Exception("can only invite if leader"));
            }

            var invitedCharacter = (PlayerCharacter)Game.Zone.Agents.FirstOrDefault(agent => IdManager.GetId(agent) == (ushort)objects[1]);

            if (invitedCharacter == null)
            {
                Debug.ThrowException(new Exception("invited agent does not exist"));
            }

            GameLogic.PartyInvite(invitedCharacter);
        }
        private void InstanceLoadRequestPlayerDataHandler(List <object> objects)
        {
            Network.GameServer.Send(GameServerMessage.PlayerData230, 0x61747431);

            Game.Player.Abilities.LoadAbilities1();

            Game.Player.Character.SkillBar.SendUpdateSkillBarPacket();

            Network.GameServer.Send(GameServerMessage.PlayerData221,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    (uint)Game.Player.Character.Level,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0);


            Game.Player.Character.Create();
            Game.Player.Abilities.Profession = Game.Player.Abilities.Profession;


            if (Game.Zone.Map != Map.AscalonCity && Game.Zone.Map != Map.RiversideProvince)
            {
                Network.GameServer.Send(GameServerMessage.MapExploration127, 0x40, 0x80, 0x1B);
                Network.GameServer.Send(GameServerMessage.MapExploration126, new uint[]
                {
                    0x000B0000, 0x0054FFFF, 0x013A043B, 0x00E8043A,
                    0x00000000, 0x00000000, 0x17000000
                });
            }
            else
            {
                Network.GameServer.Send(GameServerMessage.MapExploration127, 0x100, 0x200, 0x1E3);
                Network.GameServer.Send(GameServerMessage.MapExploration126, new uint[]
                {
                    0x0, 0xBBFF004C, 0xFB03FB02, 0xF805FA03,
                    0x707F806, 0x608E805, 0x508E608, 0x103E50A,
                    0xDD0A0403, 0x1040005, 0x1040403, 0xC3041403,
                    0x2030005, 0x50403, 0xC3041403, 0xC030005,
                    0xC4051904, 0x1A031302, 0x1A03D50A, 0x1B02D50A,
                    0x550E0A, 0x20A02C3, 0x2D10B10, 0x20A040A,
                    0x2D10B00, 0x20A040A, 0x6E30700, 0x3030208,
                    0x30E05E6, 0x20605E6, 0x30503F1, 0x32102CD,
                    0x2CD0304, 0x4020421, 0xA2202CD, 0x2DF0AF4,
                    0x20D0812, 0x21305CE, 0x2B50210, 0x2270515,
                    0x61402B5, 0x21402E0, 0xA300353C, 0xDF021803,
                    0xF807F806, 0xFA04FA07, 0xF2030304, 0xFB030403,
                    0x30DFF03, 0x42002D7, 0x20D02C5, 0x3C40520,
                    0x520020C, 0x62F03C4, 0x62F02C5, 0x3AFF05F8,
                    0xFFFF0016, 0x4FB02C7, 0x5F905FA, 0xFFFF04FA,
                    0xFFFFFFFF, 0x3EFFFFFF, 0x0, 0xFFFF0017
                });
                Network.GameServer.Send(GameServerMessage.MapExploration126, new uint[]
                {
                    0xFFFFFFFF, 0xFFFFFFFF, 0x3FC02E0, 0x6FA04FB,
                    0x4FA05F9, 0xD9003222, 0x5A029704, 0x5A02960A,
                    0x5705960A, 0x5605980A, 0x56059C05, 0x57069A07,
                    0x58069906, 0x59079707, 0x5A07900C, 0x5C06910B,
                    0xF808F60A, 0xFFFFFF06, 0x2900001A, 0xFFFFFF00,
                    0x5BFFFFFF, 0xDE03FB03, 0xDE031605, 0xDE031605,
                    0xD8031605, 0xED020202, 0xEC070502, 0xE4030114,
                    0x10DDF1F, 0x31B80F, 0xD04052E, 0x3FC02F4, 0x20605F9,
                    0x20606EE, 0x20706ED, 0x3FA04ED, 0x2FC02FB,
                    0x44602FC, 0x74503AF, 0x74503AD, 0x74503AD,
                    0x9F509F5, 0x7F001476, 0xF509F509, 0xFFFFFF02,
                    0xFFFFFFFF, 0xFFFFFFFF, 0x8AFFFF,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xFF000000
                });
            }

            Game.Zone.SpawnAgents();

            Game.Player.Abilities.LoadAbilities2();

            Network.GameServer.Send(GameServerMessage.ControlledCharacter, IdManager.GetId(Game.Player.Character), 3);

            Game.Zone.CreateParties();

            Game.State = GameState.Playing;

            LoadingComplete();
        }
Exemple #8
0
 protected override void OnCreation()
 {
     Network.GameServer.Send(GameServerMessage.CreateParty, IdManager.GetId(this));
     Network.GameServer.Send(GameServerMessage.AddPartyMember, IdManager.GetId(this), (ushort)IdManager.GetId(Leader), (byte)1);
     Network.GameServer.Send(GameServerMessage.CreatePartyStreamEnd, IdManager.GetId(this));
 }
 public void UpdateAttributes()
 {
     Network.GameServer.Send(GameServerMessage.UpdateAttributes,
                             IdManager.GetId(Game.Player.Character),
                             Serialize());
 }
 public static int GetId()
 {
     return(idManager.GetId());
 }
Exemple #11
0
 public void SendUpdateAvailableProfessionsPacket()
 {
     Network.GameServer.Send(GameServerMessage.UpdateAvailableProfessions,
                             IdManager.GetId(Game.Player.Character),
                             Serialize());
 }
Exemple #12
0
 public void SpeechBubble(string text)
 {
     Network.GameServer.Send(GameServerMessage.SpeechBubble,
                             IdManager.GetId(this),
                             new HString(text).Serialize());
 }
Exemple #13
0
        public void Open()
        {
            Debug.Requires(_sender == null || _sender.Created);

            var remainder = new string(new HString(_body).Serialize());
            int length    = remainder.Length;

            while (length > 0)
            {
                int stubLength = Math.Min(61, length);
                Network.GameServer.Send(GameServerMessage.DialogBody, remainder.Substring(0, stubLength));
                remainder = remainder.Substring(stubLength);
                length    = remainder.Length;
            }

            Network.GameServer.Send(GameServerMessage.DialogSender, (_sender != null ? IdManager.GetId(_sender) : 0));

            foreach (DialogButton button in _buttons)
            {
                Network.GameServer.Send(GameServerMessage.DialogButton,
                                        (byte)button.Icon,
                                        new HString(button.Caption).Serialize(),
                                        button.ButtonId,
                                        button.Spell);
            }
        }
Exemple #14
0
 public static void ShowMessage(string message, Agent sender, Color color = Color.DarkOrangeDarkOrange)
 {
     Network.GameServer.Send(GameServerMessage.Message, new HString(message).Serialize());
     Network.GameServer.Send(GameServerMessage.MessageSender, (ushort)IdManager.GetId(sender), (byte)color);
 }
Exemple #15
0
        public void AddMember(PlayerCharacter agent)
        {
            if (ParentZone != null && ParentZone.Parties.Any(party => party._members.Contains(agent)))
            {
                Debug.ThrowException(new Exception("agent " + agent.Name + " is already member of a party"));
            }

            _members.Add(agent);

            if (Created && ParentZone == Game.Zone)
            {
                Network.GameServer.Send(GameServerMessage.AddPartyMember, IdManager.GetId(this), (ushort)IdManager.GetId(agent), (byte)1);

                if (agent == Game.Player.Character)
                {
                    ShowParty();
                }
            }
        }
Exemple #16
0
 internal void SendAgentPropertyInt(AgentProperty identifier, uint value)
 {
     Network.GameServer.Send(GameServerMessage.AgentPropertyInt, (uint)identifier, IdManager.GetId(this), value);
 }
Exemple #17
0
        public void RemoveMember(PlayerCharacter agent)
        {
            if (!_members.Contains(agent))
            {
                Debug.ThrowException(new Exception("agent " + agent.Name + " not part of this party"));
            }

            if (_members.Count <= 1)
            {
                Debug.ThrowException(new Exception("cannot remove last member of group"));
            }

            _members.Remove(agent);

            if (Created && ParentZone == Game.Zone)
            {
                if (agent != Leader)
                {
                    Network.GameServer.Send(GameServerMessage.RemovePartyMember, IdManager.GetId(this), (ushort)IdManager.GetId(agent));


                    if (agent == Game.Player.Character)
                    {
                        Game.Zone.AddParty(new Party(Game.Player.Character));
                    }
                }
                else
                {
                    Game.Zone.RemoveParty(this);

                    var restParty = new Party(_members[0]);

                    Game.Zone.AddParty(restParty);

                    foreach (PlayerCharacter member in _members)
                    {
                        if (member == restParty.Leader)
                        {
                            continue;
                        }

                        restParty.AddMember(member);
                    }

                    foreach (Party invite in _invites)
                    {
                        restParty.AddInvite(invite);
                    }

                    foreach (Party joinRequest in _joinRequests)
                    {
                        restParty.AddJoinRequest(joinRequest);
                    }

                    Game.Zone.AddParty(new Party(Leader));
                }
            }
        }
Exemple #18
0
 internal void SendAgentTargetPropertyFloat(AgentProperty identifier, Agent target, float value)
 {
     Network.GameServer.Send(GameServerMessage.AgentTargetPropertyFloat, (uint)identifier, IdManager.GetId(target), IdManager.GetId(this), value);
 }
Exemple #19
0
        internal void SendPreActiveInformation()
        {
            foreach (PlayerCharacter member in _members)
            {
                if (Game.Zone.Parties.Any(party => party != this && party.Members.Contains(member)))
                {
                    Debug.ThrowException(new Exception("member " + member + " already part of another party"));
                }

                if (member == Leader)
                {
                    continue;
                }

                Network.GameServer.Send(GameServerMessage.AddPartyMember, IdManager.GetId(this), (ushort)IdManager.GetId(member),
                                        (byte)1);  //isLoaded
            }

            if (_members.Contains(Game.Player.Character))
            {
                ShowParty();
            }
        }
Exemple #20
0
 protected override void OnDestruction()
 {
     Network.GameServer.Send(GameServerMessage.DespawnAgent, IdManager.GetId(this));
 }
Exemple #21
0
        public void SetWeaponsetMainhandItem(Item weapon, byte weaponset)
        {
            Debug.Requires(weaponset <= 3);

            if (weaponset == _currentWeaponset)
            {
                Game.Player.Character.Inventory.SetItem(weapon, this, EquipmentSlot.Mainhand);
            }
            else
            {
                _weaponsets[weaponset].Mainhand = weapon;

                if (Game.State == GameState.Playing)
                {
                    Network.GameServer.Send(GameServerMessage.UpdateWeaponsetWeapons,
                                            (ushort)1,
                                            weaponset,
                                            _weaponsets[weaponset].Mainhand != null ? IdManager.GetId(_weaponsets[weaponset].Mainhand) : 0,
                                            _weaponsets[weaponset].Offhand != null ? IdManager.GetId(_weaponsets[weaponset].Offhand) : 0);
                }
            }
        }
Exemple #22
0
 internal void Remove()
 {
     Network.GameServer.Send((GameServerMessage)56,
                             IdManager.GetId(Creature),
                             Id);
 }
        private void KickMemberHandler(List <object> objects)
        {
            Party controlledCharacterParty = Game.Zone.Parties.FirstOrDefault(party => party.Members.Contains(Game.Player.Character));

            if (controlledCharacterParty == null)
            {
                Debug.ThrowException(new Exception("cannot kick member without party"));
            }

            if (controlledCharacterParty.Leader != Game.Player.Character)
            {
                Debug.ThrowException(new Exception("can only kick member if leader"));
            }

            var memberToKick = (PlayerCharacter)Game.Zone.Agents.FirstOrDefault(agent => IdManager.GetId(agent) == (ushort)objects[1]);

            if (memberToKick == null)
            {
                Debug.ThrowException(new Exception("agent to kick does not exist"));
            }

            GameLogic.PartyKickMember(memberToKick);
        }
        private void InstanceLoadRequestPlayerDataHandler(List <object> objects)
        {
            foreach (Map unlockedOutpost in Enum.GetValues(typeof(Map)).Cast <Map>())
            {
                Network.GameServer.Send(GameServerMessage.ShowOutpostOnWorldMap,
                                        (ushort)unlockedOutpost,
                                        (byte)0);                 //unknown
            }

            Network.GameServer.Send(GameServerMessage.PlayerData230, 1886151033);             // 1886151033=play

            Game.Player.Abilities.LoadAbilities1();

            Game.Player.Character.SkillBar.SendUpdateSkillBarPacket();

            Network.GameServer.Send(GameServerMessage.PlayerData221,
                                    540087,        //experience
                                    16920,         //kurzickFree
                                    353966,        //kurzickTotal
                                    20,            //luxonTotal
                                    4186028,       //luxonFree
                                    0,             //imperialFree
                                    0,             //imperialTotal
                                    19,            //unknown
                                    23,            //unknown
                                    (uint)Game.Player.Character.Level,
                                    100,           //morale
                                    1900,          //balthFree
                                    601665,        //balthTotal
                                    38,            //skillFree
                                    88);           //skillTotal


            Game.Player.Character.Create();
            Game.Player.Abilities.Profession = Game.Player.Abilities.Profession;


            if (Game.Zone.Map != Map.AscalonCity && Game.Zone.Map != Map.RiversideProvince)
            {
                Network.GameServer.Send(GameServerMessage.MapExploration127, 0x40, 0x80, 0x1B);
                Network.GameServer.Send(GameServerMessage.MapExploration126, new uint[]
                {
                    0x000B0000, 0x0054FFFF, 0x013A043B, 0x00E8043A,
                    0x00000000, 0x00000000, 0x17000000
                });
            }
            else
            {
                Network.GameServer.Send(GameServerMessage.MapExploration127, 0x100, 0x200, 0x1E3);
                Network.GameServer.Send(GameServerMessage.MapExploration126, new uint[]
                {
                    0x0, 0xBBFF004C, 0xFB03FB02, 0xF805FA03,
                    0x707F806, 0x608E805, 0x508E608, 0x103E50A,
                    0xDD0A0403, 0x1040005, 0x1040403, 0xC3041403,
                    0x2030005, 0x50403, 0xC3041403, 0xC030005,
                    0xC4051904, 0x1A031302, 0x1A03D50A, 0x1B02D50A,
                    0x550E0A, 0x20A02C3, 0x2D10B10, 0x20A040A,
                    0x2D10B00, 0x20A040A, 0x6E30700, 0x3030208,
                    0x30E05E6, 0x20605E6, 0x30503F1, 0x32102CD,
                    0x2CD0304, 0x4020421, 0xA2202CD, 0x2DF0AF4,
                    0x20D0812, 0x21305CE, 0x2B50210, 0x2270515,
                    0x61402B5, 0x21402E0, 0xA300353C, 0xDF021803,
                    0xF807F806, 0xFA04FA07, 0xF2030304, 0xFB030403,
                    0x30DFF03, 0x42002D7, 0x20D02C5, 0x3C40520,
                    0x520020C, 0x62F03C4, 0x62F02C5, 0x3AFF05F8,
                    0xFFFF0016, 0x4FB02C7, 0x5F905FA, 0xFFFF04FA,
                    0xFFFFFFFF, 0x3EFFFFFF, 0x0, 0xFFFF0017
                });
                Network.GameServer.Send(GameServerMessage.MapExploration126, new uint[]
                {
                    0xFFFFFFFF, 0xFFFFFFFF, 0x3FC02E0, 0x6FA04FB,
                    0x4FA05F9, 0xD9003222, 0x5A029704, 0x5A02960A,
                    0x5705960A, 0x5605980A, 0x56059C05, 0x57069A07,
                    0x58069906, 0x59079707, 0x5A07900C, 0x5C06910B,
                    0xF808F60A, 0xFFFFFF06, 0x2900001A, 0xFFFFFF00,
                    0x5BFFFFFF, 0xDE03FB03, 0xDE031605, 0xDE031605,
                    0xD8031605, 0xED020202, 0xEC070502, 0xE4030114,
                    0x10DDF1F, 0x31B80F, 0xD04052E, 0x3FC02F4, 0x20605F9,
                    0x20606EE, 0x20706ED, 0x3FA04ED, 0x2FC02FB,
                    0x44602FC, 0x74503AF, 0x74503AD, 0x74503AD,
                    0x9F509F5, 0x7F001476, 0xF509F509, 0xFFFFFF02,
                    0xFFFFFFFF, 0xFFFFFFFF, 0x8AFFFF,
                    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xFF000000
                });
            }

            Game.Zone.SpawnAgents();

            Game.Player.Abilities.LoadAbilities2();

            Network.GameServer.Send(GameServerMessage.ControlledCharacter, IdManager.GetId(Game.Player.Character), 3);

            Game.Zone.CreateParties();

            Game.State = GameState.Playing;
            // Send pending Transaction success
            //Network.AuthServer.SendTransactionSuccessCode(TransactionSuccessCode.Success);

            LoadingComplete();
        }