示例#1
0
 public GuildAcademyMember(GuildAcademy Academy, WorldCharacter Character, DateTime RegisterDate, GuildAcademyRank Rank)
 {
     this.Academy = Academy;
     this.Character = Character;
     this.RegisterDate = RegisterDate;
     this.Rank = Rank;
 }
示例#2
0
        public GuildAcademyMember(GuildAcademy Academy, WorldCharacter Character, DataRow Row)
        {
            this.Academy = Academy;
            this.Character = Character;

            Load(Row);
        }
示例#3
0
 public static void WriteLook(WorldCharacter wchar, Packet packet)
 {
     packet.WriteByte(Convert.ToByte(0x01 | (wchar.Character.Job << 2) | (Convert.ToByte(wchar.Character.Male)) << 7));
     packet.WriteByte(wchar.Character.Hair);
     packet.WriteByte(wchar.Character.HairColor);
     packet.WriteByte(wchar.Character.Face);
 }
示例#4
0
        public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet)
        {
            packet.WriteInt(wchar.Character.ID);
            packet.WriteString(wchar.Character.Name, 16);
            packet.WriteUShort(wchar.Character.CharLevel);
            packet.WriteByte(wchar.Character.Slot);
            MapInfo mapinfo;
            if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.Map, out mapinfo))
            {
                Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.Map);
                wchar.Character.Map = 0;//we reset
                packet.WriteString("Rou", 12);
            }
            else
            {
                packet.WriteString(mapinfo.ShortName, 12);
            }
            packet.WriteByte(0);               // UNK
            packet.WriteInt(0x00000000);       // Random seed
            WriteLook(wchar, packet);
            WriteEquipment(wchar, packet);
            WriteRefinement(wchar, packet);
            packet.Fill(4, 0xff);      		// UNK
            packet.WriteString("Rou", 12); //TODO: load from mapinfo.shn
            packet.WriteInt(0);				// X, doesn't matter
            packet.WriteInt(0);        		// Y, neither

            packet.WriteInt(0x63dd45ca);
            packet.WriteByte(0);
            packet.WriteInt(100);      		// Test later!
            packet.WriteByte(0);
            wchar.Detach();
        }
示例#5
0
 public static void WriteRefinement(WorldCharacter wchar, Packet pPacket)
 {
     //TODO: pPacket.WriteByte(Convert.ToByte(this.Inventory.GetEquippedUpgradesByType(ItemType.Weapon) << 4 | this.Inventory.GetEquippedUpgradesByType(ItemType.Shield)));
     pPacket.WriteByte(0xff); //this must be the above, but currently not cached
     pPacket.WriteByte(0xff);    		// UNK
     pPacket.WriteByte(0xff);    		// UNK
 }
示例#6
0
 public static bool GetLoggedInCharacter(string Name, out WorldCharacter pChar)
 {
     Networking.WorldClient pClient = ClientManager.Instance.GetClientByCharname(Name);
        pChar = null;
     if (pClient != null)
     {
         pChar = pClient.Character;
         return true;
     }
     return false;
 }
示例#7
0
 public void ApprenticeLevelUP(WorldCharacter pChar)
 {
     MasterMember pMember = pChar.MasterList.Find(d => d.IsMaster == true);
     if (pMember != null)
     {
         //Todo Add Break if the difference is greater than 5
         AddApprenticeReward(pChar);
         MasterMember.UpdateLevel(pChar.Character.CharLevel, pChar.Character.Name);
         if(pMember.pMember.Character.Client != null)
         SendApprenticeLevelUp(pMember.pMember,pChar.Character.Name,pChar.Character.CharLevel);
     }
 }
示例#8
0
文件: Friend.cs 项目: Dextan/Estrella
        public static Friend Create(WorldCharacter pCharacter)
        {
            Friend friend = new Friend
            {
                ID = pCharacter.Character.ID,
                Name = pCharacter.Character.Name,
                Level = pCharacter.Character.CharLevel,
                Job = pCharacter.Character.Job,
                Map = GetMapname(pCharacter.Character.PositionInfo.Map),
                UniqueID = (uint)pCharacter.Character.AccountID,
                IsOnline = pCharacter.IsIngame,
                client = pCharacter.Client,
            };

            return friend;
        }
示例#9
0
 public static void WriteEquipment(WorldCharacter wchar, Packet packet)
 {
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Helm));
     packet.WriteUShort(Settings.Instance.ShowEquips ? wchar.GetEquipBySlot(ItemSlot.Weapon) : (ushort)0xffff);
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Armor));
     packet.WriteUShort(Settings.Instance.ShowEquips ? wchar.GetEquipBySlot(ItemSlot.Weapon2) : (ushort)0xffff);
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Pants));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Boots));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeBoots));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumePants));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeArmor));
     packet.Fill(6, 0xff);              // UNK
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Glasses));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeHelm));
     packet.Fill(2, 0xff);              // UNK
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeWeapon));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Wing));
     packet.Fill(2, 0xff);              // UNK
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Tail));
     packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Pet));
 }
示例#10
0
        public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet)
        {
            packet.WriteInt(wchar.Character.ID); //charid
            packet.FillPadding(wchar.Character.Name, 0x10);
            packet.WriteInt(0);//unk
            packet.WriteShort((short)wchar.Character.CharLevel); //level
            packet.WriteByte(wchar.Character.Slot);
            MapInfo mapinfo;
            if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.PositionInfo.Map, out mapinfo))
            {
                Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.PositionInfo.Map);
                wchar.Character.PositionInfo.Map = 0;
                packet.FillPadding(mapinfo.ShortName, 0x0D); //townname
            }
            else
            {
                packet.FillPadding(mapinfo.ShortName, 0x0D); //townname
            }

            //packet.WriteByte(0); // UNK
            packet.WriteInt(0); // Random seed
            WriteLook(wchar,packet);
            WriteEquipment(wchar,packet);
            WriteRefinement(wchar,packet);
            packet.WriteByte(0);

            packet.WriteByte(0xF0);
            packet.WriteByte(0xFF);//unk
            packet.WriteByte(0xFF);

            packet.FillPadding(mapinfo.ShortName, 0x0c);
            packet.WriteInt(0); //pos
            packet.WriteInt(0); //pos
            packet.WriteUShort(0xdb78);
            packet.WriteUShort(4910);//unk
            packet.WriteUShort(25600);
            packet.Fill(4, 0);
        }
示例#11
0
 public void LoadBasic(WorldCharacter pChar)
 {
     try
     {
         locker.WaitOne();
         DataTable equips = null;
         using (DatabaseClient dbClient = Program.DatabaseManager.GetClient())
         {
             equips = dbClient.ReadDataTable("SELECT * FROM equips WHERE Owner=" + pChar.ID + " AND Slot < 0");
         }
         if (equips != null)
         {
             foreach (DataRow row in equips.Rows)
             {
                 Equip loaded = Equip.LoadEquip(row);
                 EquippedItems.Add(loaded);
             }
         }
     }
     finally
     {
         locker.ReleaseMutex();
     }
 }
示例#12
0
 private static void SendCharOKResponse(WorldClient client, WorldCharacter character)
 {
     using (var packet = new Packet(SH5Type.CharCreationOK))
     {
         packet.WriteByte(1);
         PacketHelper.WriteBasicCharInfo(character, packet);
         client.SendPacket(packet);
     }
 }
示例#13
0
 public OnCharacterLoginArgs(WorldCharacter pChar,OnCharacterLoginArgs args)
 {
 }
示例#14
0
 public bool GetCharacterByID(int ID, out WorldCharacter pChar)
 {
     World.Networking.WorldClient pclient = ClientManager.Instance.GetClientByCharID(ID);
        if (pclient != null)
        {
        pChar = pclient.Character;
        return true;
        }
        else
        {
        pChar = null;
       Character DBpChar  =  ReadMethods.ReadCharObjectByIDFromDatabase(ID,Program.DatabaseManager);
       WorldCharacter ReaderChar = new WorldCharacter(DBpChar, null);
       pChar = ReaderChar;
       if (DBpChar == null)
       {
           return false;
       }
       return true;
        }
 }
示例#15
0
 public static void OnetestmapChange(WorldCharacter pChar)
 {
     Console.WriteLine(pChar.Character.PositionInfo.Map);
     Console.WriteLine(pChar.Character.PositionInfo.XPos);
     Console.WriteLine(pChar.Character.PositionInfo.YPos);
 }
示例#16
0
 public static void InvokeChangeMapEvent(WorldCharacter pChar)
 {
     OnCharacterChangeMap.Invoke(pChar);
 }
示例#17
0
 public static void InvokdeIngame(WorldCharacter pChar)
 {
     CharacterLogin.Invoke(pChar);
 }
示例#18
0
 public static void invokeLoggetInEvent(WorldCharacter pChar)
 {
     OnCharacterLogin.Invoke(pChar);
 }
示例#19
0
 public static void invokeLevelUp(WorldCharacter pChar)
 {
     OnCharacterLevelUp.Invoke(pChar);
 }
示例#20
0
        public WorldCharacter CreateCharacter(string name, byte slot, byte hair, byte color, byte face, Job job, bool ismale)
        {
            if (Characters.ContainsKey(slot) || slot > 5)
                return null;
            //TODO: check if hair etc are actual beginner ones! (premium hack)
            //NOTE: Check the SHN's for this -> Moved to database
            BaseStatsEntry stats = DataProvider.Instance.JobBasestats[job];
            if (stats == null)
            {
                //NOTE be serious.. please
                // Log.WriteLine(LogLevel.Warn, "Houston, we have a problem! Jobstats not found for job {0}", job.ToString());
                Log.WriteLine(LogLevel.Error, "Jobstats not found for job {0}", job.ToString());
                return null;
            }
            Database.Storage.LookInfo newLook = new Database.Storage.LookInfo();
            Database.Storage.PositionInfo newPos = new Database.Storage.PositionInfo();
            Database.Storage.Character newchar = new Database.Storage.Character();
            newchar.AccountID = this.AccountID;
            newchar.CharLevel = 1;
            newchar.Name = name;
            newLook.Face = face;
            newLook.Hair = hair;
            newLook.HairColor = color;
            newchar.Job = (byte)job;
            newLook.Male = ismale;
            newchar.Slot = slot;
            newPos.XPos = 7636;
            newPos.YPos = 4610;
            newchar.HP = (short)stats.MaxHP;
            newchar.SP = (short)stats.MaxSP;
            newchar.HPStones = (short)stats.MaxHPStones;
            newchar.SPStones = (short)stats.MaxSPStones;
            newchar.LookInfo = newLook;
            newchar.PositionInfo = newPos;
            int charID = newchar.ID;
             DatabaseClient client = Program.DatabaseManager.GetClient();

             string query =
                 "INSERT INTO `characters` " +
                 "(`AccountID`,`Name`,`MasterJoin`,`Slot`,`Job`,`Male`,`Hair`,`HairColor`,`Face`," +
                 " `QuickBar`, `QuickBarState`, `ShortCuts`, `GameSettings`, `ClientSettings`) " +
                 "VALUES " +
                     "('" + newchar.AccountID +
                     "', '" + newchar.Name +
                     "', '" + DateTime.Now.ToDBString() +
                        "', " +		newchar.Slot +
                        ", " +		newchar.Job  +
                        ", " +		Convert.ToByte(newchar.LookInfo.Male) +
                        ", " +		newchar.LookInfo.Hair +
                        ", " +		newchar.LookInfo.HairColor +
                        ", " +		newchar.LookInfo.Face +
                        ", " +      "0" +
                        ", " +      "0" +
                        ", " +      "0" +
                        ", " +      "0" +
                        ", " +      "0" +
                        ")";
                client.ExecuteQuery(query);

            WorldCharacter tadaa = new WorldCharacter(newchar,this);
            ushort begineqp = GetBeginnerEquip(job);

            if (begineqp > 0)
            {
                sbyte eqp_slot = (sbyte)((job == Job.Archer) ? -10 : -12); //, (job == Job.Archer) ? (byte)12 : (byte)10, begineqp)
                Equip eqp = new Equip((uint)newchar.ID, begineqp, eqp_slot);
                tadaa.Inventory.AddToEquipped(eqp);
                client.ExecuteQuery("INSERT INTO equips (owner,slot,EquipID) VALUES ('"+tadaa.ID+"','"+eqp_slot+"','"+eqp.EquipID+"')");
            }
            Characters.Add(slot, tadaa);
            return tadaa;
        }
示例#21
0
 public OnCharacterLevelUpArgs(WorldCharacter pChar = null)
 {
     this.PCharacter = pChar;
 }
示例#22
0
 public static void InvokeLoggetOutInEvent(WorldCharacter pChar)
 {
     OnCharacterLogout.Invoke(pChar);
 }
示例#23
0
 public static void OneLoadGuildInCharacter(WorldCharacter pChar)
 {
     DatabaseClient dbClient = Program.DatabaseManager.GetClient();
      int GuildID = dbClient.ReadInt32("SELECT GuildID FROM guildmembers WHERE CharID='" + pChar.ID + "'");
      int AcademyID = dbClient.ReadInt32("SELECT GuildID FROM guildacademymembers WHERE CharID='" + pChar.ID + "'");
     if(AcademyID > 0 && GuildID == 0)
     {
         Data.Guilds.Guild g;
         if (!Data.Guilds.GuildManager.GetGuildByID(AcademyID, out g))
             return;
         pChar.GuildAcademy = g.Academy;
         pChar.IsInGuildAcademy = true;
     }
     else if(GuildID > 0 && AcademyID == 0)
     {
         Data.Guilds.Guild g;
         if (!Data.Guilds.GuildManager.GetGuildByID(GuildID, out g))
             return;
         pChar.Guild = g;
         pChar.GuildAcademy = g.Academy;
         pChar.IsInGuild = true;
         Data.Guilds.GuildMember GuildMember = g.Members.Find(m => m.Character.Character.Name == pChar.Character.Name);
         GuildMember.Character.Client = pChar.Client;
     }
 }
示例#24
0
 public void RemoveMasterMember(WorldCharacter pChar,string name)
 {
     MasterMember pMember = pChar.MasterList.Find(d => d.pMemberName == name);
     WorldClient pClient = ClientManager.Instance.GetClientByCharname(name);
     if (pClient != null)
     {
         SendApprenticeRemoveMaster(pClient, pMember.pMemberName);
         pClient.Character.MasterList.Remove(pMember);
     }
     pMember.RemoveFromDatabase();
     pMember.RemoveFromDatabase(pChar.Character.ID, pMember.pMemberName);
     pChar.MasterList.Remove(pMember);
     pChar.UpdateMasterJoin();
 }
示例#25
0
文件: Friend.cs 项目: Dextan/Estrella
 /// <summary>
 /// Updates friend status using a <see cref="WorldCharacter" /> object.
 /// </summary>
 /// <param name="pCharacter">The WorldCharacter object with the new data.</param>
 public void Update(WorldCharacter pCharacter)
 {
     this.Map = GetMapname(pCharacter.Character.PositionInfo.Map);
     this.Job = pCharacter.Character.Job;
     this.Level = pCharacter.Character.CharLevel;
     this.IsOnline = ClientManager.Instance.IsOnline(pCharacter.Character.Name);
 }
示例#26
0
 public OnCharacterLogoutArgs(WorldCharacter pChar)
 {
     this.PCharacter = pChar;
 }
示例#27
0
        private void AddApprenticeReward(WorldCharacter pChar)
        {
            List<MasterRewardItem> Rewards = DataProvider.Instance.MasterRewards.FindAll(d => (byte)d.Job == pChar.Character.Job && d.Level == pChar.Character.CharLevel);
            MasterRewardItem rr = new MasterRewardItem
            {
                ItemID = 250,
                Count = 1,
            };
            ZoneConnection Conn = Program.GetZoneByMap(pChar.Character.PositionInfo.Map);
            if (Conn == null)
                return;

            using (var packet = new Packet(SH37Type.SendApprenticeReward))
            {

                packet.WriteByte((byte)Rewards.Count);//count
                foreach (var pReward in Rewards)
                {
                    packet.WriteUShort(pReward.ItemID);
                    packet.WriteByte(pReward.Count);
                    packet.WriteByte(0);//unk
                    InterHandler.SendAddReward(Conn, pReward.ItemID,pReward.Count,pChar.Character.Name);
                }
                pChar.Client.SendPacket(packet);
            }
        }
示例#28
0
文件: Group.cs 项目: Dextan/Estrella
        public void ChangeDropType(WorldCharacter pBy, byte pDropState)
        {
            if (pBy.Character.Name != Master.Name)
                return;		// only the master may change drop state!
            this.DropState = (DropState)pDropState;

            UpdateDropStateToMembers();
        }
示例#29
0
 public void BroadcastInRange(WorldCharacter pChar, Packet pPacket, bool ToAll)
 {
     pChar.BroucastPacket(pPacket);
 }
示例#30
0
文件: Group.cs 项目: Dextan/Estrella
        public void InviteNewMember(WorldCharacter pSender, string pTarget)
        {
            if (!ClientManager.Instance.IsOnline(pTarget))
                return;
            if (Master.Name != pSender.Character.Name)
                return;		// only the master may invite new Members

            GroupManager.Instance.Invite(pSender.Client, pTarget); // trololol
        }