private static void MountDescriptionRequest(WorldClient Client, string Packet) { int DDid = -1; try { DDid = int.Parse(Regex.Split(Packet.Substring(2), ("\\|"))[0]); //on ignore le temps? } catch (Exception e) { } if (DDid == -1) { return; } Mount DD = MountTable.getMount(DDid); if (DD == null) { return; } Client.Send(new MountDescriptionMessage(DD)); }
private void Initialize() { this.myStats = new GenericStats(this); for (int i = 1; i < 16; i++) { var Item = this.InventoryCache.GetItemInSlot((ItemSlotEnum)i); if (Item != null) { this.myStats.Merge(Item.GetStats()); this.Life += Item.GetStats().GetTotal(EffectEnum.AddVitalite); } } if (this.ZaapString != null) { foreach (String str in ZaapString.Split(',')) { short zaap; if (!short.TryParse(str, out zaap)) { continue; } try { Zaaps.Add(zaap); } catch (Exception e) { Logger.Error(e); } } } else { if (Settings.AppSettings.GetBoolElement("World.AllZaap")) { foreach (short map in ZaapTable.Cache.Keys) { this.Zaaps.Add(map); } } } if (this.MountID != -1) { Mount = MountTable.getMount(this.MountID); if (Mount != null) { Mount.Intialize(); } } if (this.SpellString == null || this.SpellString == "") { this.mySpells = SpellBook.GenerateForBreed((ClassEnum)this.Classe); for (int i = 1; i < Client.GetCharacter().Level; i++) { this.mySpells.GenerateLevelUpSpell((ClassEnum)Client.GetCharacter().Classe, i); } Client.Send(new BasicNoOperationMessage()); Client.Send(new SpellsListMessage(Client.Character)); } else { this.mySpells = SpellBook.FromDatabase(this.SpellString); } if (LifePer <= 0) { LifePer = 1; } Life = (MaxLife * LifePer / 100); if (Life == 0) { Life = 1; } _exPdv = Life; this.myInitialized = true; }
private static void ProcessExchangeMountParkRequest(WorldClient Client, string Packet) { MountPark MP = Client.Character.inMountPark; if (MP != null) { char c = Packet[2]; Packet = Packet.Substring(3); int guid = -1; try { guid = int.Parse(Packet); } catch (Exception e) { }; switch (c) { case 'C': //Parcho => Etable (Stocker) if (guid == -1 || !Client.Character.InventoryCache.hasItemGuid(guid)) { return; } InventoryItemModel obj = Client.Character.InventoryCache.GetItem(guid); //on prend la DD demandée int DDid = -1; Mount DD = null; if (obj.GetStats().HasEffect(EffectEnum.MountOwner)) { DDid = obj.GetStats().GetEffect(EffectEnum.MountOwner).Items; DD = MountTable.getMount(DDid); } //FIXME mettre return au if pour ne pas créer des nouvelles dindes if (DD == null) { int color = StaticMountTable.getMountColorByParchoTemplate(obj.TemplateID); if (color < 1) { return; } DD = new Mount(color); } DD.Intialize(); //On enleve l'Item du Monde et du Perso Client.Character.InventoryCache.remove(guid); InventoryItemTable.removeItem(guid); //on ajoute la dinde a l'étable Client.Account.Data.Mounts.Add(DD.ID, DD); Client.Account.Data.Save(); //On envoie les Packet Client.Send(new ObjectRemoveMessage(obj.ID)); Client.Send(new ExchangeEndMessage('+', DD.parse())); break; case 'c': //Etable => Parcho(Echanger) Mount DD1 = MountTable.getMount(guid); //S'il n'a pas la dinde if (!Client.Account.Data.Mounts.ContainsKey(DD1.ID) || DD1 == null) { return; } //on retire la dinde de l'étable Client.Account.Data.Mounts.Remove(DD1.ID); GenericStats Stat = new GenericStats(); Stat.AddItem(EffectEnum.MountOwner, DD1.ID); Stat.AddSpecialEffect(EffectEnum.MountOwnerName, Client.Character.Name); Stat.AddSpecialEffect(EffectEnum.MountName, DD1.Name); var item = InventoryItemTable.TryCreateItem(StaticMountTable.getMountScroll(DD1.get_color()).ID, Client.Character, 1, -1, Stat.ToItemStats()); Client.Send(new ExchangeEndMessage('-', DD1.ID + "")); Stat = null; break; case 'g': //Equiper Mount DD3 = MountTable.getMount(guid); //S'il n'a pas la dinde if (DD3 == null || !Client.Account.Data.Mounts.ContainsKey(DD3.ID) || Client.Character.Mount != null) { return; } DD3.Intialize(); Client.Account.Data.Mounts.Remove(DD3.ID); Client.Account.Data.Save(); Client.Character.Mount = DD3; //Packets Client.Send(new CharacterRideEventMessage("+", DD3)); Client.Send(new ExchangeEndMessage('-', DD3.ID + "")); Client.Send(new CharacterMountXpGive(Client.Character.MountXPGive)); break; case 'p': //Equipé => Stocker //Si c'est la dinde équipé if (Client.Character.Mount != null ? Client.Character.Mount.ID == guid : false) { //Si le perso est sur la monture on le fait descendre if (Client.Character.isOnMount()) { Client.Character.toogleOnMount(); } //Si ca n'a pas réussie, on s'arrete là (Items dans le sac ?) if (Client.Character.isOnMount()) { return; } Mount DD2 = Client.Character.Mount; DD2.Intialize(); Client.Account.Data.Mounts.Add(DD2.ID, DD2); Client.Account.Data.Save(); Client.Character.Mount = null; //Packets Client.Send(new ExchangeEndMessage('+', DD2.parse())); Client.Send(new CharacterRideEventMessage("-", null)); Client.Send(new CharacterMountXpGive(Client.Character.MountXPGive)); } else //Sinon... { } break; } } else { Client.Send(new BasicNoOperationMessage()); return; } }
public void Initialize() { if (myInitialized) { return; } try { BHI = new Dictionary <int, List <BidHouseItem> >(); if (!BidHouseTable.BHITEMS.ContainsKey(this.Guid)) { BidHouseTable.BHITEMS.Add(Guid, new Dictionary <int, List <BidHouseItem> >()); } BHI = BidHouseTable.BHITEMS[Guid]; foreach (String s in Friends.Split(';')) { if (String.IsNullOrEmpty(s)) { continue; } FriendsList.Add(Convert.ToInt32(s.Split('|')[0]), s.Split('|')[1]); } foreach (String s in Ennemys.Split(';')) { if (String.IsNullOrEmpty(s)) { continue; } EnnemyList.Add(Convert.ToInt32(s.Split('|')[0]), s.Split('|')[1]); } foreach (String s in Bank.Split(';')) { if (String.IsNullOrEmpty(s)) { continue; } long id; if (!long.TryParse(s, out id)) { continue; } InventoryItemModel obj = InventoryItemTable.getItem(id); if (obj != null) { bankItems.Add(id, obj); } else { obj = InventoryItemTable.Load(id); if (obj != null) { bankItems.Add(id, obj); } } } foreach (String s in Stables.Split(';')) { if (String.IsNullOrEmpty(s)) { continue; } int id; if (!int.TryParse(s, out id)) { continue; } Mount DD = MountTable.getMount(id); if (DD != null) { Mounts.Add(id, DD); } } } catch (Exception e) { Logger.Error(e); } myInitialized = true; }