public Character(SMob mob) { this.Mob = mob; this.Skill = new List <int>(); this.PartyID = new List <int>(); this.Positions = new List <SPosition>(); }
//Carrega a lista de mob e npcs public static void LoadNPC() { DateTime start = Time; StreamReader stream = new StreamReader($"{Dir}NPCGenerator.xml"); XmlSerializer desserializador = new XmlSerializer(typeof(List <SMobList>)); List <SMobList> mobGenerator = (List <SMobList>)desserializador.Deserialize(stream); MobList = new List <SMobList>(); for (int i = 0; i < mobGenerator.Count(); i++) { string path = @"mobs\" + mobGenerator[i].MobName.Trim() + ".xml"; SMob mob = ReadMob(path); SMobList vaMobList = mobGenerator[i]; mob.LastPosition = vaMobList.PositionInicial; vaMobList.Mob = mob; vaMobList.Mob.ClientId = (short)(1000 + i); MobList.Add(vaMobList); } Log.Information($"Mob, foram gerados {MobList.Where(a => a.Mob.Merchant == 0).Count():N0} mobs, carregada em [{Time - start}]"); Log.Information($"Npc, foram gerados {MobList.Where(a => a.Mob.Merchant > 0).Count():N0} npcs, carregada em [{Time - start}]"); }
public static SSpawn New(SMob mob, Int16 sessionId, String paramTab) //: base(0x364, 0x7530) { SSpawn tmp = new SSpawn { SpawnType = 2,/*1-efeito normal/2-efeito m**********r*/ Position = mob.LastPosition, SessionId = sessionId, Name = mob.Name, ItemEffect = new SItemEF[3], AffectEffect = new SItemEF[3], Status = mob.BaseStatus, AnctCode = new Byte[16], TabValue = paramTab, ChaosPoints = 200, TotalKill = 200, Unknow_100 = 0xCC00, GuildIndex = 0, }; for (int x = 0; x < 16; x++) { SItem item = mob.Equip[x]; //ItemEffect.Effects[x] = (short)(Calculos.CalculoEfeito(item, x)); // AnctCode[x] = (byte)(Calculos.CalculoAnct(mob, x)); } return(tmp); }
// Construtor public Character() { this.Mob = default; this.Skill = new List <int>(); this.PartyID = new List <int>(); this.Positions = new List <SPosition>(); }
public ulong [] Exp; // 812 a 843 = 32 // Construtores public static SCharList New(Client client) { SCharList tmp = new SCharList { Unk1 = new byte [4] { 0, 0, 0, 0 }, PosX = new short [4], PosY = new short [4], Name = new SCharListName [4], Status = new SStatus [4], Equips = new SCharListEquip [4], Unk2 = new byte [8] { 0, 0, 0, 0, 0, 0, 0, 0 }, Gold = new int [4], Exp = new ulong [4] }; for (int i = 0; i < 4; i++) { if (client.Account.Characters [i] == null) { tmp.PosX [i] = 0; tmp.PosY [i] = 0; tmp.Name [i] = SCharListName.New(""); tmp.Status [i] = SStatus.New( ); tmp.Equips [i] = SCharListEquip.New( ); tmp.Gold [i] = 0; tmp.Exp [i] = 0; } else { SMob mob = client.Account.Characters [i].Mob; tmp.PosX [i] = mob.LastPosition.X; tmp.PosY [i] = mob.LastPosition.Y; tmp.Name [i] = SCharListName.New(mob.Name); tmp.Status [i] = mob.GameStatus; tmp.Equips [i] = SCharListEquip.New(mob.Equip); tmp.Gold [i] = mob.Gold; tmp.Exp [i] = mob.Exp; } } return(tmp); }
public short Unknown; //14 a 15 = 2 public static void controller(Client client, P_27B p_27b) { SMob npc = Config.MobList.Where(a => a.Mob.ClientId == p_27b.npcID).FirstOrDefault().Mob; if (npc.Merchant == (short)NpcMerchant.Skill) { client.Send(P_17C.New(npc, ShopType.Skill)); } else { client.Send(P_17C.New(npc, ShopType.Normal)); } }
// Controlador public static void Controller(Client client, P_20F rcv) { if (!Regex.IsMatch(rcv.Name, @"^[A-Za-z0-9-]{4,12}$")) { client.Send(P_101.New("Somente letras e números no nome. 4 a 12 caracteres.")); } else if (rcv.Slot < 0 || rcv.Slot > 3) { client.Close( ); } else if (rcv.ClassInfo < 0 || rcv.ClassInfo > 3) { client.Close( ); } else { // Retorna character da conta ref Character character = ref client.Account.Characters [rcv.Slot]; // Verifica se não está vaziu if (character != null) { client.Close( ); } else { // Inicializa novo character character = new Character( ); // Referencia o MOB do character ref SMob mob = ref character.Mob; // Inicializa a classe selecionada no MOB switch (rcv.ClassInfo) { case 1: mob = SMob.FM(rcv.Name); break; case 2: mob = SMob.BM(rcv.Name); break; case 3: mob = SMob.HT(rcv.Name); break; default: mob = SMob.TK(rcv.Name); break; } // Atualiza os status do MOB Functions.GetCurrentScore(character, true); // Envia os pacotes de criação de personagem client.Send(P_110.New(client)); client.Send(P_101.New($"Personagem [{rcv.Name}] criado! Bom jogo!")); }
public static bool permicaoEquipItem(SItem paramItemAEquipar, SMob userMob, int slot) { if (paramItemAEquipar.Id != 0) { SItemList itemList = Config.Itemlist[paramItemAEquipar.Id]; if (userMob.BaseStatus.Level >= itemList.Level && userMob.BaseStatus.Str >= itemList.Str && userMob.BaseStatus.Int >= itemList.Int && userMob.BaseStatus.Dex >= itemList.Dex && userMob.BaseStatus.Con >= itemList.Con) { return(true); } } return(false); }
// Construtores public static SMobList New() { SMobList tmp = new SMobList() { Mob = SMob.New(), Number = 0, Speed = 1, PositionInicial = SPosition.New(), PositionFinal = SPosition.New(), FreqStep = 1, IdGroup = 0, Tab = "" }; return(tmp); }
// Controlador public static void Controller(Client client, P_20F rcv) { if (!Regex.IsMatch(rcv.Name, @"^[A-Za-z0-9-]{4,12}$")) { client.Send(P_101.New("Somente letras e números no nome. 4 a 12 caracteres.")); } else if (rcv.Slot < 0 || rcv.Slot > 3) { client.Close( ); } else if (rcv.ClassInfo < 0 || rcv.ClassInfo > 3) { client.Close( ); } else { // Retorna character da conta ref Character character = ref client.Account.Characters[rcv.Slot]; // Verifica se não está vaziu if (character != null) { client.Close( ); } else { character = new Character(SMob.New()); character.Mob.Name = rcv.Name; character.Mob.ClassInfo = (ClassInfo)rcv.ClassInfo; character = UserMobDAO.CreateOrUpdateChar(character); if (character != null) { //Atualiza o xml da account para salvar o novo char criado UserAccountDAO.CreateOrUpdateAccount(client.Account); // Envia os pacotes de criação de personagem client.Send(P_110.New(client)); client.Send(P_101.New($"Personagem [{character.Mob.Name}] criado! Bom jogo!")); } else { client.Send(P_101.New($"Erro ao criar o personagem, contate o suporte!")); } } }
public static P_336 New(Client client) { SMob mob = client.Character.Mob; P_336 tmp = new P_336 { Header = SHeader.New(0x0336, Marshal.SizeOf <P_336>(), client.ClientId), Status = new SStatus(), Critical = mob.Critical, SaveMana = mob.SaveMana, Affect = Functions.GetAffect(mob.Affects), Guild = mob.GuildIndex, GuildLevel = mob.GuildIndex, Resist = mob.Resistencia, Magic = mob.MagicIncrement, Special = new byte[4], CurrMp = mob.GameStatus.CurMP, CurrHp = mob.GameStatus.CurHP }; tmp.Status.Level = mob.GameStatus.Level; tmp.Status.Defense = mob.GameStatus.Defense; tmp.Status.Attack = mob.GameStatus.Attack; tmp.Status.MobSpeed = mob.GameStatus.MobSpeed; tmp.Status.MaxHP = mob.GameStatus.MaxHP; tmp.Status.MaxMP = mob.GameStatus.MaxMP; tmp.Status.CurHP = mob.GameStatus.CurHP; tmp.Status.CurMP = mob.GameStatus.CurMP; tmp.Status.Str = mob.GameStatus.Str; tmp.Status.Int = mob.GameStatus.Int; tmp.Status.Dex = mob.GameStatus.Dex; tmp.Status.Con = mob.GameStatus.Con; tmp.Status.Master = mob.GameStatus.Master; for (int i = 0; i < tmp.Special.Length; i++) { tmp.Special[i] = (byte)mob.GameStatus.Master[i]; } return(tmp); }
public static void controller(Client client, P_379 p379) { SMob Npc = Config.MobList.Where(a => a.Mob.ClientId == p379.NpcId).FirstOrDefault().Mob; SItem itemId = Config.MobList.Where(a => a.Mob.ClientId == p379.NpcId).FirstOrDefault().Mob.Inventory[p379.SlotNpc]; SItemList item = Config.Itemlist[itemId.Id]; if (item.Price <= client.Character.Mob.Gold) { int tamanho = 30; if (client.Character.Mob.Andarilho[0].Id != 0) { tamanho += 15; } if (client.Character.Mob.Andarilho[1].Id != 0) { tamanho += 15; } //checa se o inventario esta cheio if (client.Character.Mob.Inventory.Where(a => a.Id != 0).Count() == tamanho) { client.Send(P_101.New("O inventario esta cheio.")); } else { client.Character.Mob.Gold -= item.Price; client.Character.Mob.Inventory[p379.InventorySlot] = itemId; //Adiciona o item no inventorio client.Character.Mob.AddItemToCharacter(client, itemId, TypeSlot.Inventory, p379.InventorySlot); //atualiza o gold do mob client.Send(P_3AF.New(client, client.Character.Mob.Gold)); } } else { client.Send(P_101.New("Gold insuficiente")); } }
public int Tax; //231 a 235 = 4 public static P_17C New(SMob mob, ShopType janela) { P_17C tmp = new P_17C { Header = SHeader.New(0x017c, Marshal.SizeOf <P_17C>(), mob.ClientId), ShopType = janela, Inventory = new SItem[27], Tax = 5, }; int count = 0; SItem[] inventario = mob.Inventory.Where(a => a.Id != 0).ToArray(); if (janela == ShopType.Skill) { for (int i = 0; i < inventario.Length; i++) { if (i == 8 || i == 16) { tmp.Inventory[i + count] = new SItem(); count = count + 1; tmp.Inventory[i + count] = inventario[i]; } else { tmp.Inventory[i + count] = inventario[i]; } } } else { for (int i = 0; i < inventario.Length; i++) { tmp.Inventory[i] = inventario[i]; } } return(tmp); }
public static Character CreateOrUpdateChar(Character character) { lock (m_Locker) { DeleteCharFile(character); SMob userMob = SMob.New(); switch (character.Mob.ClassInfo) { case ClassInfo.TK: userMob = SMob.TK(character.Mob.Name); break; case ClassInfo.FM: userMob = SMob.FM(character.Mob.Name); break; case ClassInfo.BM: userMob = SMob.BM(character.Mob.Name); break; case ClassInfo.HT: userMob = SMob.HT(character.Mob.Name); break; } using (XmlWriter xw = XmlWriter.Create(GetPath(character.Mob.Name), m_WriterSettings)) m_Serializator.Serialize(xw, character); if (Exists(character.Mob.Name)) { return(new Character(userMob)); } return(null); } }
public static void controller(Client client, P_28B p28b) { SMob npc = Config.MobList.Where(a => a.Mob.ClientId == p28b.Index).FirstOrDefault().Mob; switch (npc.Merchant) { case 4: // Dragon Dourado { break; } case 10: // Amuleto Mistico { break; } case 11: // Exploit Leader | testar { break; } case 12: // Jeffi { break; } case 13: // Shama { break; } case 14: // Rei Azul { break; } case 15: // Rei Vermelho { break; } case 19: // Composicao Sephi { break; } case 26: // Rei { break; } case 30: // Zakum { break; } case 31: // Mestre Habilidade { break; } case 58: // Mount Master { break; } case 62: // Dragon Arzan { break; } case 68: // God Government { break; } case 72: // Uxamll { break; } case 74: // Kibita { break; } case 76: // Urnammu { break; } case 78: // Black Oracle { break; } case 100: // Quest Mortal { int npcGrade = Config.Itemlist[npc.Equip[0].Id].Grade; switch (npcGrade) { case 0: // Coveiro { int levelAtual = client.Character.Mob.GameStatus.Level; if (levelAtual < 39 || levelAtual >= 115) { client.Send(P_333.New(p28b.Index, "Nível Insuficiente. Isto não pode ser utilizado.")); break; } // Verifica se existe o ticket de entrada if (client.Character.Mob.Inventory.Where(a => a.Id == 4038).Any()) { int slot = 0; // Procura em qual slot o ticket esta for (int i = 0; i < client.Character.Mob.Inventory.Length; i++) { if (client.Character.Mob.Inventory[i].Id == 4038) { break; } else { slot += 1; } } // Remove o ticket client.Character.Mob.RemoveItemToCharacter(client, TypeSlot.Inventory, slot); // Envia o client para a quest P_290.Teleport(client, SPosition.New(new Random().Next(2395, 2398), new Random().Next(2102, 2105))); } else { client.Send(P_333.New(p28b.Index, $"Você deve trazer o item {Config.Itemlist[4038].Name}.")); } break; } case 1: // Jardineiro { int levelAtual = client.Character.Mob.GameStatus.Level; if (levelAtual < 115 || levelAtual >= 190) { client.Send(P_333.New(p28b.Index, "Nível Insuficiente. Isto não pode ser utilizado.")); break; } // Verifica se existe o ticket de entrada if (client.Character.Mob.Inventory.Where(a => a.Id == 4039).Any()) { int slot = 0; // Procura em qual slot o ticket esta for (int i = 0; i < client.Character.Mob.Inventory.Length; i++) { if (client.Character.Mob.Inventory[i].Id == 4039) { break; } else { slot += 1; } } // Remove o ticket client.Character.Mob.RemoveItemToCharacter(client, TypeSlot.Inventory, slot); // Envia o client para a quest P_290.Teleport(client, SPosition.New(new Random().Next(2232, 2335), new Random().Next(1712, 1716))); } else { client.Send(P_333.New(p28b.Index, $"Você deve trazer o item {Config.Itemlist[4039].Name}.")); } break; } case 2: // Kaizen { int levelAtual = client.Character.Mob.GameStatus.Level; if (levelAtual < 190 || levelAtual >= 265) { client.Send(P_333.New(p28b.Index, "Nível Insuficiente. Isto não pode ser utilizado.")); break; } // Verifica se existe o ticket de entrada if (client.Character.Mob.Inventory.Where(a => a.Id == 4040).Any()) { int slot = 0; // Procura em qual slot o ticket esta for (int i = 0; i < client.Character.Mob.Inventory.Length; i++) { if (client.Character.Mob.Inventory[i].Id == 4040) { break; } else { slot += 1; } } // Remove o ticket client.Character.Mob.RemoveItemToCharacter(client, TypeSlot.Inventory, slot); // Envia o client para a quest P_290.Teleport(client, SPosition.New(new Random().Next(462, 466), new Random().Next(3900, 3904))); } else { client.Send(P_333.New(p28b.Index, $"Você deve trazer o item {Config.Itemlist[4040].Name}.")); } break; } case 3: // Hidra { int levelAtual = client.Character.Mob.GameStatus.Level; if (levelAtual < 265 || levelAtual >= 320) { client.Send(P_333.New(p28b.Index, "Nível Insuficiente. Isto não pode ser utilizado.")); break; } // Verifica se existe o ticket de entrada if (client.Character.Mob.Inventory.Where(a => a.Id == 4041).Any()) { int slot = 0; // Procura em qual slot o ticket esta for (int i = 0; i < client.Character.Mob.Inventory.Length; i++) { if (client.Character.Mob.Inventory[i].Id == 4041) { break; } else { slot += 1; } } // Remove o ticket client.Character.Mob.RemoveItemToCharacter(client, TypeSlot.Inventory, slot); // Envia o client para a quest P_290.Teleport(client, SPosition.New(new Random().Next(666, 670), new Random().Next(3754, 3758))); } else { client.Send(P_333.New(p28b.Index, $"Você deve trazer o item {Config.Itemlist[4041].Name}.")); } break; } case 4: // Elfo { int levelAtual = client.Character.Mob.GameStatus.Level; if (levelAtual < 320 || levelAtual >= 350) { client.Send(P_333.New(p28b.Index, "Nível Insuficiente. Isto não pode ser utilizado.")); break; } // Verifica se existe o ticket de entrada if (client.Character.Mob.Inventory.Where(a => a.Id == 4042).Any()) { int slot = 0; // Procura em qual slot o ticket esta for (int i = 0; i < client.Character.Mob.Inventory.Length; i++) { if (client.Character.Mob.Inventory[i].Id == 4042) { break; } else { slot += 1; } } // Remove o ticket client.Character.Mob.RemoveItemToCharacter(client, TypeSlot.Inventory, slot); // Envia o client para a quest P_290.Teleport(client, SPosition.New(new Random().Next(1320, 1324), new Random().Next(4039, 4043))); } else { client.Send(P_333.New(p28b.Index, $"Você deve trazer o item {Config.Itemlist[4042].Name}.")); } break; } case 5: // Lider Aprendiz { break; } case 7: // Persen case 8: case 9: { break; } case 13: // Capa do Reino { break; } case 14: // Capa verde { break; } case 15: // Molar Gargula { break; } case 16: // Treinador quest newbie 1 { break; } case 17: // Treinador quest newbie 2 { break; } case 18: // Treinador quest newbie 3 { break; } case 19: // Treinador quest Newbie 4 { break; } case 22: // Sobrevivente { break; } case 30: // Guarda Real { break; } } break; } case 120: // Carbuncle buff { if (client.Character.Mob.GameStatus.Level >= 100) { client.Send(P_333.New(p28b.Index, "Nível Insuficiente. Isto não pode ser utilizado.")); break; } int id = 5040; //buffa o cliente for (int i = 0; i < 4; i++) { if (i == 1) { id++; } id++; SSkillList skil = Config.SkilList.Where(a => a.IdSkill == id).FirstOrDefault(); client.Character.Mob.Affects[Functions.GetSlotAffect(client, id)].Index = (byte)skil.TipoDeEfeito; client.Character.Mob.Affects[Functions.GetSlotAffect(client, id)].Value = (byte)skil.ValorDoEfeito; client.Character.Mob.Affects[Functions.GetSlotAffect(client, id)].Time = skil.TempoDoEfeito; } Functions.GetCurrentScore(client, false); client.Send(P_333.New(p28b.Index, $"Sente-se mais forte agora {client.Character.Mob.Name}?")); break; } } }
private static SMob convertMobBinToXml(STRUCT_MOB paMob) { SMob mob = SMob.New(); mob.Name = paMob.name; mob.CapaReino = paMob.Clan; mob.Merchant = paMob.Merchant; mob.GuildIndex = paMob.Guild; mob.ClassInfo = paMob.Class > 4 ? ClassInfo.TK : (ClassInfo)paMob.Class; mob.AffectInfo = paMob.resistencia; mob.QuestInfo = paMob.Quest; mob.Gold = paMob.gold; // mob.Unk1 = new byte[0](paMob.Unk1); mob.Exp = (ulong)paMob.Exp; mob.LastPosition = SPosition.New(paMob.SPX, paMob.SPY); mob.BaseStatus = new SStatus(); mob.GameStatus = new SStatus(); mob.Equip = new SItem[16]; mob.Inventory = new SItem[60]; mob.Andarilho = new SItem[2]; //mob.Unk2 = new byte[8]; mob.Item547 = 0; mob.ChaosPoints = 0; mob.CurrentKill = 0; mob.TotalKill = 0; //mob.Unk3 = new byte[2]; mob.LearnedSkill = paMob.LearnedSkill; mob.StatusPoint = paMob.ScoreBonus; mob.MasterPoint = paMob.SpecialBonus; mob.SkillPoint = paMob.SkillBonus; mob.Critical = paMob.Critical; mob.SaveMana = paMob.SaveMana; mob.SkillBar1 = paMob.SkillBar; //mob.Unk4 = new byte[4]; mob.Resistencia[0] = paMob.Resist[0]; mob.Resistencia[1] = paMob.Resist[1]; mob.Resistencia[2] = paMob.Resist[2]; mob.Resistencia[3] = paMob.Resist[3]; //mob.Unk5 = new byte[210]; mob.MagicIncrement = (short)paMob.Magic; mob.Tab = ""; mob.BaseStatus.Level = paMob.BaseScore.Level; mob.BaseStatus.Defense = paMob.BaseScore.Defesa; mob.BaseStatus.Attack = paMob.BaseScore.Ataque; mob.BaseStatus.Merchant = paMob.BaseScore.Merchante; mob.BaseStatus.MobSpeed = paMob.BaseScore.Speed; mob.BaseStatus.Direction = paMob.BaseScore.Direcao; mob.BaseStatus.ChaosRate = paMob.BaseScore.ChaosRate; mob.BaseStatus.MaxHP = paMob.BaseScore.MaxHP; mob.BaseStatus.MaxMP = paMob.BaseScore.MaxMP; mob.BaseStatus.CurHP = paMob.BaseScore.HP; mob.BaseStatus.CurMP = paMob.BaseScore.MP; mob.BaseStatus.Str = paMob.BaseScore.Str; mob.BaseStatus.Int = paMob.BaseScore.Int; mob.BaseStatus.Dex = paMob.BaseScore.Dex; mob.BaseStatus.Con = paMob.BaseScore.Con; /// mob.GameStatus.Level = paMob.CurrentScore.Level; mob.GameStatus.Defense = paMob.CurrentScore.Defesa; mob.GameStatus.Attack = paMob.CurrentScore.Ataque; mob.GameStatus.Merchant = paMob.CurrentScore.Merchante; mob.GameStatus.MobSpeed = paMob.CurrentScore.Speed; mob.GameStatus.Direction = paMob.CurrentScore.Direcao; mob.GameStatus.ChaosRate = paMob.CurrentScore.ChaosRate; mob.GameStatus.MaxHP = paMob.CurrentScore.MaxHP; mob.GameStatus.MaxMP = paMob.CurrentScore.MaxMP; mob.GameStatus.CurHP = paMob.CurrentScore.HP; mob.GameStatus.CurMP = paMob.CurrentScore.MP; mob.GameStatus.Str = paMob.CurrentScore.Str; mob.GameStatus.Int = paMob.CurrentScore.Int; mob.GameStatus.Dex = paMob.CurrentScore.Dex; mob.GameStatus.Con = paMob.CurrentScore.Con; mob.Affects = new SAffect[32]; for (int i = 0; i < paMob.Equip.Length; i++) { mob.Equip[i].Id = paMob.Equip[i].sIndex; mob.Equip[i].Ef = new SItemEF[3]; for (int a = 0; a < paMob.Equip[i].sEffect.Length; a++) { mob.Equip[i].Ef[a].Type = paMob.Equip[i].sEffect[a].cEfeito; mob.Equip[i].Ef[a].Value = paMob.Equip[i].sEffect[a].cValue; } } try { for (int i = 0; i < 60; i++) { mob.Inventory[i].Id = paMob.Carry[i].sIndex; mob.Inventory[i].Ef = new SItemEF[3]; for (int a = 0; a < paMob.Carry[i].sEffect.Length; a++) { mob.Inventory[i].Ef[a].Type = paMob.Carry[i].sEffect[a].cEfeito; mob.Inventory[i].Ef[a].Value = paMob.Carry[i].sEffect[a].cValue; } } } catch (Exception ex) { Console.WriteLine(ex);; } return(mob); }
// Construtor public Character( ) { this.Mob = default; this.Positions = new List <SPosition> ( ); }