public GuildAcademyMember(GuildAcademy Academy, WorldCharacter Character, DateTime RegisterDate, GuildAcademyRank Rank) { this.Academy = Academy; this.Character = Character; this.RegisterDate = RegisterDate; this.Rank = Rank; }
public GuildAcademyMember(GuildAcademy Academy, WorldCharacter Character, DataRow Row) { this.Academy = Academy; this.Character = Character; Load(Row); }
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); }
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(); }
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 }
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; }
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); } }
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; }
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)); }
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); }
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(); } }
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); } }
public OnCharacterLoginArgs(WorldCharacter pChar,OnCharacterLoginArgs args) { }
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; } }
public static void OnetestmapChange(WorldCharacter pChar) { Console.WriteLine(pChar.Character.PositionInfo.Map); Console.WriteLine(pChar.Character.PositionInfo.XPos); Console.WriteLine(pChar.Character.PositionInfo.YPos); }
public static void InvokeChangeMapEvent(WorldCharacter pChar) { OnCharacterChangeMap.Invoke(pChar); }
public static void InvokdeIngame(WorldCharacter pChar) { CharacterLogin.Invoke(pChar); }
public static void invokeLoggetInEvent(WorldCharacter pChar) { OnCharacterLogin.Invoke(pChar); }
public static void invokeLevelUp(WorldCharacter pChar) { OnCharacterLevelUp.Invoke(pChar); }
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; }
public OnCharacterLevelUpArgs(WorldCharacter pChar = null) { this.PCharacter = pChar; }
public static void InvokeLoggetOutInEvent(WorldCharacter pChar) { OnCharacterLogout.Invoke(pChar); }
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; } }
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(); }
/// <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); }
public OnCharacterLogoutArgs(WorldCharacter pChar) { this.PCharacter = pChar; }
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); } }
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(); }
public void BroadcastInRange(WorldCharacter pChar, Packet pPacket, bool ToAll) { pChar.BroucastPacket(pPacket); }
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 }