Ejemplo n.º 1
0
        private void UpdateMemberPosition(GroupMember member)
        {
            if (!member.IsOnline)
                return;
            using (var packet = new Packet(SH14Type.UpdatePartyMemberLoc))
            {
                packet.WriteString(member.Name, 0x10);
                packet.WriteInt(member.Character.Position.X);
                packet.WriteInt(member.Character.Position.Y);

                AnnouncePacketToUpdatable(packet);
            }
        }
Ejemplo n.º 2
0
 internal void CharacterMoved(GroupMember groupMember, int oldx, int oldy, int newx, int newy)
 {
     using (var packet = new Packet(SH14Type.UpdatePartyMemberLoc))
     {
         packet.WriteByte(1);	// 		unk
         packet.WriteString(groupMember.Name, 16);
         packet.WriteInt(newx);
         packet.WriteInt(newy);
         AnnouncePacket(packet);
     }
 }
Ejemplo n.º 3
0
 public void AddMember(ZoneCharacter pCharacter, bool pIsMaster)
 {
     GroupMember mem = new GroupMember();
     mem.Character = pCharacter;
     mem.Group = this;
     mem.IsMaster = pIsMaster;
     mem.IsOnline = true;
     mem.Name = pCharacter.Name;
     pCharacter.GroupMember = mem;
     pCharacter.LevelUp += OnCharacterLevelUp;
     pCharacter.Group = this;
     pCharacter.GroupMember = mem;
     this.Members.Add(mem);
 }
Ejemplo n.º 4
0
        public void AddMember(string pName, bool pIsMaster = false)
        {
            GroupMember mem = new GroupMember();
            mem.Character = null;
            mem.Group = this;
            mem.IsMaster = pIsMaster;
            mem.IsOnline = false;
            mem.Name = pName;

            if (ClientManager.Instance.HasClient(pName))
            {
                mem.IsOnline = true;
                var client = ClientManager.Instance.GetClientByCharName(pName);
                mem.Character = client.Character;
                mem.Character.LevelUp += OnCharacterLevelUp;
                mem.Character.Group = this;
                mem.Character.GroupMember = mem;
            }

            this.Members.Add(mem);
        }
Ejemplo n.º 5
0
        public static GroupMember ReadGroupMemberFromDatabase(long pCharId)
        {
            //--------------------------------------------------
            // Quries used in this function
            //--------------------------------------------------
            const string get_groupmem_query =
                            "SELECT `Name`, `IsGroupMaster` " +
                            "FROM `fiesta_world`.`characters` " +
                            "WHERE `CharID` = '{0}'";

            //--------------------------------------------------
            // Read member from database.
            //--------------------------------------------------
            string name = "";
            bool isOnline = false;
            bool isMaster = false;

            using (var client = Program.DatabaseManager.GetClient())
            using (var cmd = new MySqlCommand(string.Format(get_groupmem_query, pCharId), client.GetConnection()))
            using (var reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    name = reader.GetString("Name");
                    if (reader.IsDBNull(reader.GetOrdinal("IsGroupMaster")))
                        isMaster = false;
                    else
                        isMaster = reader.GetBoolean("IsGroupMaster");
                }
            }

            GroupMember member = new GroupMember(name, isMaster, isOnline);
            if (ClientManager.Instance.HasClient(name))
            {
                var client = ClientManager.Instance.GetClientByCharName(name);
                member.IsOnline = true;
                member.Character = client.Character;
            }
            else
                member.IsOnline = (bool)InterFunctionCallbackProvider.Instance.QueuePacket(id =>
                {
                    var packet = new InterPacket(InterHeader.FunctionCharIsOnline);
                    packet.WriteLong(id);
                    packet.WriteString(name, 16);
                    return packet;
                }, packet =>
                {
                    bool value = false;
                    packet.TryReadBool(out value);
                    return value;
                });
            return member;
        }