public override bool SetKamas(int amount) { if (TaxCollector.IsFighting || !TaxCollector.IsInWorld) { return(false); } if (amount > 0) { return(false); } amount = Math.Abs(amount); if (TaxCollector.GatheredKamas <= 0) { amount = 0; } if (TaxCollector.GatheredKamas < amount) { amount = TaxCollector.GatheredKamas; } TaxCollector.GatheredKamas -= amount; Character.Inventory.AddKamas(amount); Character.Client.Send(new StorageKamasUpdateMessage(TaxCollector.GatheredKamas)); if (TaxCollector.Bag.Count == 0 && TaxCollector.GatheredKamas == 0) { TaxCollector.Delete(); } return(true); }
public static InventoryItemModel TryCreateItem(int templateId, TaxCollector TCollector, int quantity = 1, short position = -1, string Stats = null, Boolean useMax = false) { if (!ItemTemplateTable.Cache.ContainsKey(templateId)) // Template inexistant { return(null); } // Recup template var Template = ItemTemplateTable.GetTemplate(templateId); // Creation var Item = new InventoryItemModel() { ID = DatabaseCache.nextItemGuid++, TemplateID = templateId, Position = position, Quantity = quantity, Effects = (Stats == null ? Template.GenerateStats().ToItemStats() : Stats) }; Item.GetStats(); // Ajout de l'item dans l'inventaire TCollector.Items.Add(Item.ID, Item); addItem(Item, true); return(Item); }
public PercepteurFight(Map Map, WorldClient Player, TaxCollector Monsters) : base(FightType.TYPE_PVT, Map) { try { Logger.Debug("PVT_FIGHT Launched : Player=" + Player.GetCharacter().Name + " MapId=" + Map.Id); this.TaxCollector = Monsters; StartTimer(); var AttFighter = new CharacterFighter(this, Player); var DefFighter = new PercepteurFighter(this, TaxCollector, this.NextActorId); TaxCollector.Map.DestroyActor(TaxCollector); TaxCollector.Guild.Send(new GuildFightInformationsMesssage(TaxCollector.Guild)); foreach (var member in TaxCollector.Guild.CharactersGuildCache.Where(x => x.getPerso() != null && x.getPerso().IsOnline())) { TaxCollector.parseAttaque(member.getPerso(), TaxCollector.GuildID); TaxCollector.parseDefense(member.getPerso(), TaxCollector.GuildID); member.getPerso().Send(new ChatGameMessage("Un de vos percepteurs est attaqué!", "CC0000")); } Player.AddGameAction(new GameFight(AttFighter, this)); base.InitFight(AttFighter, DefFighter); } catch (Exception ex) { Logger.Error("PercepteurFight::PercepteurFight() " + ex.ToString()); } }
public static void Add(TaxCollector item) { try { MySqlCommand Command = new MySqlCommand() { Connection = DatabaseManager.Provider.getConnection(), CommandText = "REPLACE INTO `taxcollector` VALUES(@guid,@map,@cell,@or,@guild,@n1,@n2,@item,@kamas,@xp);", }; Command.Prepare(); Command.Parameters.AddWithValue("@guid", item.ActorId); Command.Parameters.AddWithValue("@map", item.Mapid); Command.Parameters.AddWithValue("@cell", item.CellId); Command.Parameters.AddWithValue("@or", item.Orientation); Command.Parameters.AddWithValue("@n1", item.N1); Command.Parameters.AddWithValue("@guild", item.GuildID); Command.Parameters.AddWithValue("@n2", item.N2); Command.Parameters.AddWithValue("@item", item.getItemsId()); Command.Parameters.AddWithValue("@kamas", item.Kamas); Command.Parameters.AddWithValue("@xp", item.XP); Command.ExecuteNonQuery(); Cache.Add(item.ActorId, item); } catch (Exception e) { Logger.Error("Can't execute query : " + e.ToString()); } }
public static void Load() { Cache.Clear(); long time = Environment.TickCount; var reader = DatabaseManager.Provider.ExecuteReader("SELECT * FROM taxcollector"); while (reader.Read()) { var template = new TaxCollector() { ActorId = reader.GetInt64("guid"), Mapid = reader.GetInt16("mapid"), CellId = reader.GetInt32("cellid"), Orientation = reader.GetInt32("orientation"), GuildID = reader.GetInt32("guild_id"), N1 = reader.GetInt16("N1"), N2 = reader.GetInt16("N2"), ItemList = reader.GetString("objets"), Kamas = reader.GetInt64("kamas"), XP = reader.GetInt64("xp"), }; Cache.Add(template.ActorId, template); if (template.Map != null) { template.Map.SpawnActor(template); } } reader.Close(); Cache.Values.ToList().ForEach(x => x.Intialize()); Logger.Info("Loaded @'" + Cache.Count + "'@ TaxCollector in @" + (Environment.TickCount - time) + "@ ms"); }
public void Close() { Character.CloseDialog(this); TaxCollector.OnDialogClosed(this); DialogHandler.SendLeaveDialogMessage(Character.Client, DialogType); }
protected override void DeterminsWinners() { Winners = TaxCollector.IsDead() ? (FightTeam)ChallengersTeam : DefendersTeam; Losers = TaxCollector.IsDead() ? (FightTeam)DefendersTeam : ChallengersTeam; Draw = false; OnWinnersDetermined(Winners, Losers, Draw); }
public void Open() { Character.SetDialoger(m_collector); TaxCollector.OnDialogOpened(this); InventoryHandler.SendExchangeStartedTaxCollectorShopMessage(Character.Client, TaxCollector); //Attention, la fenêtre d'échange se fermera automatiquement dans %1 minutes. Character.SendInformationMessage(TextInformationTypeEnum.TEXT_INFORMATION_ERROR, 139, 5); Timer = Character.Area.CallDelayed((5 * 60 * 1000), Close); }
public void Open() { Character.SetDialog(this); TaxCollector.OnDialogOpened(this); Character.Client.Send(new NpcDialogCreationMessage(TaxCollector.Map.Id, TaxCollector.Id)); Character.Client.Send( new TaxCollectorDialogQuestionExtendedMessage(TaxCollector.Guild.GetBasicGuildInformations(), (short)TaxCollector.Guild.TaxCollectorPods, (short)TaxCollector.Guild.TaxCollectorProspecting, (short)TaxCollector.Guild.TaxCollectorWisdom, (sbyte)TaxCollector.Guild.TaxCollectors.Count, 0, TaxCollector.GatheredKamas, TaxCollector.GatheredExperience, TaxCollector.Bag.BagWeight, TaxCollector.Bag.BagValue)); }
private static void ProcessGuildPutPerceptorRequest(WorldClient Client, string Packet) { if (!Client.GetCharacter().HasGuild() || !Client.GetCharacter().getCharacterGuild().Can(GuildRightEnum.RIGHT_PUT_PERCEPTOR) || Client.GetCharacter().GetGuild().CharactersGuildCache.Count < 10) { Client.Send(new BasicNoOperationMessage()); } else { short price = (short)(1000 + 10 * Client.GetCharacter().GetGuild().Level); if (Client.GetCharacter().Kamas < price) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 82)); } if (TaxCollectorTable.Cache.Where(x => x.Value.Mapid == Client.Character.myMap.Id).Count() > 0) { Client.Send(new ImMessage("1168;1")); return; } if (Client.Character.myMap.FightCell.Length < 5) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 13)); } if (TaxCollectorTable.Cache.Values.Where(x => x.GuildID == Client.Character.GetGuild().ID).Count() >= Client.Character.GetGuild().PerceptorMaxCount) { return; } short random1 = (short)Random.Next(1, 39); short random2 = (short)Random.Next(1, 71); TaxCollector perco = new TaxCollector() { ActorId = TaxCollectorTable.getNextGuid(), Mapid = Client.Character.myMap.Id, CellId = Client.Character.CellId, Orientation = 3, GuildID = Client.Character.GetGuild().ID, N1 = random1, N2 = random2, ItemList = "", Kamas = 0L, XP = 0L, }; TaxCollectorTable.Add(perco); Client.Character.myMap.SpawnActor(perco); Client.Send(new GameActorShowMessage(GameActorShowEnum.SHOW_SPAWN, perco)); Client.Send(new GuildFightInformationsMesssage(Client.Character.GetGuild())); Client.Character.GetGuild().Send(new GuildTaxCollectorMessage("S" + perco.N1 + "," + perco.N2 + "|" + perco.Mapid + "|" + perco.Map.X + "|" + perco.Map.Y + "|" + Client.Character.Name)); } }
public PercepteurFighter(Fight Fight, TaxCollector Monster, int MonsterGuid) : base(Fight, GameActorTypeEnum.TYPE_TAX_COLLECTOR) { this.TaxCollector = Monster; TaxCollector.Guild.Initialize(); TaxCollector.inFight = (byte)1; TaxCollector.CurrentFight = Fight; var oldStat = this.TaxCollector.Guild.FightStats; oldStat.AddBase(EffectEnum.AddVitalite, Monster.Guild.Level * 100); oldStat.AddBase(EffectEnum.AddPA, 6); oldStat.AddBase(EffectEnum.AddPM, 3); base.InitFighter(oldStat, MonsterGuid, 6000); base.JoinFight(); }
public static GameObject ReturnTaxCollector(TaxCollector active, List <GameObject> objects) { ThumbnailKey thumbnail = ThumbnailKey.kInvalidThumbnailKey; string text = string.Empty; List <ObjectPicker.RowInfo> list = new List <ObjectPicker.RowInfo>(); foreach (GameObject t in objects) { List <ObjectPicker.ColumnInfo> list2 = new List <ObjectPicker.ColumnInfo>(); int num = 0; thumbnail = t.GetThumbnailKey(); if (t.GetType() == typeof(TaxCollector)) { text = (t as TaxCollector).info.Name; num = (t as TaxCollector).info.Funds; } if (t.GetType() == typeof(DonationBox)) { text = (t as DonationBox).info.Name; num = (t as DonationBox).info.Funds; } //common list2.Add(new ObjectPicker.ThumbAndTextColumn(thumbnail, text)); list2.Add(new ObjectPicker.MoneyColumn(num)); ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(t, list2); list.Add(item); } List <ObjectPicker.HeaderInfo> list3 = new List <ObjectPicker.HeaderInfo>(); List <ObjectPicker.TabInfo> list4 = new List <ObjectPicker.TabInfo>(); list3.Add(new ObjectPicker.HeaderInfo(string.Empty, string.Empty, 200)); list3.Add(new ObjectPicker.HeaderInfo(CommonMethodsTaxCollector.LocalizeString("Funds", new object[0]), CommonMethodsTaxCollector.LocalizeString("Funds", new object[0]))); list4.Add(new ObjectPicker.TabInfo("coupon", ShoppingRegister.LocalizeString("AvailableConcessionsFoods", new object[0]), list)); List <ObjectPicker.RowInfo> list5 = TaxCollectorSimpleDialog.Show(CommonMethodsTaxCollector.LocalizeString("TransferToObject", new object[0]), 0, list4, list3, true); if (list5 == null || list5.Count != 1) { return(null); } return(list5[0].Item as GameObject); }
public static void TryDeleteTax(TaxCollector tc) { try { lock (Cache) { Cache.Remove(tc.ActorId); tc.Items.Values.ToList().ForEach(x => InventoryItemTable.removeItem(x.ID)); } DatabaseManager.Provider.ExecuteQuery("DELETE FROM taxcollector WHERE guid = '" + tc.ActorId + "'"); } catch (Exception ex) { Logger.Error("DatabaseEntities::TryDeleteperco : Guid=" + tc.ActorId + " " + ex.ToString()); } }
/// <summary> /// Removes the specified tax collector. /// </summary> /// <param name="taxCollector">The tax collector, which must not be <c>null</c>.</param> public override void Remove(TaxCollector taxCollector) { Debug.Assert(taxCollector != null, "playerName must not be null."); lock ( locker ) { var indexOf = TaxCollectors.IndexOf(taxCollector); if (indexOf == -1) { return; } NonQuery("DELETE FROM TaxCollectors WHERE WorldId = @0 AND PlayerName = @1", Main.worldID, taxCollector.PlayerName); TaxCollectors.RemoveAt(indexOf); } }
public void Close() { Character.Area.UnregisterTimer(Timer); Character.CloseDialog(this); TaxCollector.OnDialogClosed(this); if (TaxCollector.IsDisposed) { return; } TaxCollectorHandler.SendGetExchangeGuildTaxCollectorMessage(TaxCollector.Guild.Clients, GetExchangeGuildTaxCollector()); InventoryHandler.SendExchangeLeaveMessage(Character.Client, DialogType, false); TaxCollector.Guild.AddXP(TaxCollector.GatheredExperience); TaxCollector.Delete(); }
public static void Update(TaxCollector item) { try { MySqlCommand Command = new MySqlCommand() { Connection = DatabaseManager.Provider.getConnection(), CommandText = "UPDATE `taxcollector` set objets = @objets, kamas = @kamas, xp = @xp WHERE guid= @guid;", }; Command.Prepare(); Command.Parameters.AddWithValue("@objets", item.getItemsId()); Command.Parameters.AddWithValue("@kamas", item.Kamas); Command.Parameters.AddWithValue("@xp", item.XP); Command.Parameters.AddWithValue("@guid", item.ActorId); Command.ExecuteNonQuery(); } catch (Exception e) { Logger.Error(e); } }
/// <summary> /// Adds a player name to the tax collector list. /// </summary> /// <param name="playerName"></param> public override TaxCollector AddTaxCollector(string playerName) { Debug.Assert(playerName != null, "playerName must not be null."); lock ( locker ) { if (TaxCollectorNames.Contains(playerName)) { return(null); } NonQuery( "INSERT INTO TaxCollectors (WorldId, PlayerName)" + "VALUES (@0, @1)", Main.worldID, playerName); var tc = new TaxCollector(playerName); TaxCollectors.Add(tc); TaxCollectorNames.Add(playerName); return(tc); } }
// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); waitTime = startWaitTime; randomSpot = 0; lastSpot = moveSpots.Length - 1; animator.SetFloat("Speed", speed); curfew = false; checkPlayer = false; taxCollected = false; failedSteal = false; taxChase = false; criminalChase = false; activePatrol = true; timeTracker = clock.AddComponent <TimeTracker>(); taxCollectorScript = taxCollector.GetComponent <TaxCollector>(); mp3 = music.GetComponent <MusicPlayer>(); playerInteract = Player.GetComponent <PlayerInteract>(); }
private static void ProcesssRemoveTaxCollector(WorldClient Client, string Packet) { if (!Client.GetCharacter().HasGuild() || !Client.GetCharacter().getCharacterGuild().Can(GuildRightEnum.RIGHT_PUT_PERCEPTOR) || Client.GetFight() != null || Client.GetCharacter().isAaway) { Client.Send(new BasicNoOperationMessage()); return; } long TaxID; if (!long.TryParse(Packet.Substring(2), out TaxID)) { Client.Send(new BasicNoOperationMessage()); return; } if (Client.GetCharacter().myMap.GetActor(TaxID) != null && Client.GetCharacter().myMap.GetActor(TaxID).ActorType != World.Maps.GameActorTypeEnum.TYPE_TAX_COLLECTOR) { Client.Send(new BasicNoOperationMessage()); return; } var TaxC = Client.GetCharacter().myMap.GetActor(TaxID) as TaxCollector; if (TaxC == null || TaxC.inFight > 0) { Client.Send(new BasicNoOperationMessage()); return; } Client.GetCharacter().myMap.DestroyActor(TaxC); TaxCollectorTable.TryDeleteTax(TaxC); StringBuilder toSend = new StringBuilder("gITM").Append(TaxCollector.parsetoGuild(TaxC.GuildID)); toSend.Append((char)0x00); toSend.Append("gT").Append("R").Append(TaxC.N1).Append(",").Append(TaxC.N2).Append("|"); toSend.Append(TaxC.Mapid).Append("|"); toSend.Append(TaxC.Map.X).Append("|").Append(TaxC.Map.Y).Append("|").Append(Client.Character.Name); Client.Character.GetGuild().Send(new EmptyMessage(toSend.ToString())); }
public static void ProcessPacket(WorldClient Client, string Packet) { switch (Packet[1]) { case 'B': // BoostStats GuildHandler.ProcessGuildBoostStatsRequest(Client, Packet); break; case 'b': // BoostSpell GuildHandler.ProcessGuildBoostSpellRequest(Client, Packet); break; case 'V': // Create Leave GuildHandler.ProcessGuildCreationLeaveRequest(Client); break; case 'C': // Create GuildHandler.ProcessGuildCreateRequest(Client, Packet); break; case 'K': // Leave GuildHandler.ProcessGuildKickRequest(Client, Packet); break; case 'F': // Remove Perceptor GuildHandler.ProcesssRemoveTaxCollector(Client, Packet); break; case 'P': // Change Grade GuildHandler.ProcessGuildPromoteMembeRequest(Client, Packet); break; case 'H': // PutPerceptor GuildHandler.ProcessGuildPutPerceptorRequest(Client, Packet); break; case 'I': switch (Packet[2]) { case 'B': // Basic Infos GuildHandler.ProcessGuildBoostInformationsRequest(Client); break; case 'G': // General Infos GuildHandler.ProcessGuildGeneralInfosRequest(Client, Packet); break; case 'M': // Members Infos GuildHandler.ProcessGuildMemberInformationsRequest(Client); break; case 'F': // MountPark Infos if (!Client.Character.HasGuild()) { Client.Send(new BasicNoOperationMessage()); return; } Client.Send(new GuildMountParkInformationMessage(Client.Character.GetGuild())); break; case 'T': // Perceptor Fight Infos if (!Client.Character.HasGuild()) { Client.Send(new BasicNoOperationMessage()); return; } Client.Send(new GuildFightInformationsMesssage(Client.Character.GetGuild())); TaxCollector.parseAttaque(Client.GetCharacter(), Client.GetCharacter().GetGuild().ID); TaxCollector.parseDefense(Client.GetCharacter(), Client.GetCharacter().GetGuild().ID); break; } break; case 'J': switch (Packet[2]) { case 'R': GuildHandler.ProcessGuildJoinRequest(Client, Packet); break; case 'K': GuildHandler.ProcessGuildJoinRequestAccept(Client); break; case 'E': GuildHandler.ProcessGuildJoinRequestDeclin(Client); break; } break; case 'T': switch (Packet[2]) { case 'J': //Rejoindre GuildHandler.ProcessTaxCollectorJoinFigh(Client, Packet.Substring(2)); break; } break; } }
public abstract void Remove(TaxCollector taxCollector);
public static GameObject ReturnTaxCollector(TaxCollector active, List<GameObject> objects) { ThumbnailKey thumbnail = ThumbnailKey.kInvalidThumbnailKey; string text = string.Empty; List<ObjectPicker.RowInfo> list = new List<ObjectPicker.RowInfo>(); foreach (GameObject t in objects) { List<ObjectPicker.ColumnInfo> list2 = new List<ObjectPicker.ColumnInfo>(); int num = 0; thumbnail = t.GetThumbnailKey(); if (t.GetType() == typeof(TaxCollector)) { text = (t as TaxCollector).info.Name; num = (t as TaxCollector).info.Funds; } if (t.GetType() == typeof(DonationBox)) { text = (t as DonationBox).info.Name; num = (t as DonationBox).info.Funds; } //common list2.Add(new ObjectPicker.ThumbAndTextColumn(thumbnail, text)); list2.Add(new ObjectPicker.MoneyColumn(num)); ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(t, list2); list.Add(item); } List<ObjectPicker.HeaderInfo> list3 = new List<ObjectPicker.HeaderInfo>(); List<ObjectPicker.TabInfo> list4 = new List<ObjectPicker.TabInfo>(); list3.Add(new ObjectPicker.HeaderInfo(string.Empty, string.Empty, 200)); list3.Add(new ObjectPicker.HeaderInfo(CommonMethodsTaxCollector.LocalizeString("Funds", new object[0]), CommonMethodsTaxCollector.LocalizeString("Funds", new object[0]))); list4.Add(new ObjectPicker.TabInfo("coupon", ShoppingRegister.LocalizeString("AvailableConcessionsFoods", new object[0]), list)); List<ObjectPicker.RowInfo> list5 = TaxCollectorSimpleDialog.Show(CommonMethodsTaxCollector.LocalizeString("TransferToObject", new object[0]), 0, list4, list3, true); if (list5 == null || list5.Count != 1) { return null; } return (list5[0].Item as GameObject); }
public static long CalculateXpWinPerco(TaxCollector TaxCollector, List <Fighter> Winners, List <Fighter> Loosers, long GrouXp) { Guild G = TaxCollector.Guild; float sag = G.BaseStats.GetTotal(EffectEnum.AddSagesse); float coef = (sag + 100) / 100; int taux = Settings.AppSettings.GetIntElement("Rate.Pvm"); long xpWin = 0; int lvlmax = 0; foreach (Fighter entry in Winners) { if (entry.Level > lvlmax) { lvlmax = entry.Level; } } int nbbonus = 0; foreach (Fighter entry in Winners) { if (entry.Level > (lvlmax / 3)) { nbbonus += 1; } } double bonus = 1; if (nbbonus == 2) { bonus = 1.1; } if (nbbonus == 3) { bonus = 1.3; } if (nbbonus == 4) { bonus = 2.2; } if (nbbonus == 5) { bonus = 2.5; } if (nbbonus == 6) { bonus = 2.8; } if (nbbonus == 7) { bonus = 3.1; } if (nbbonus >= 8) { bonus = 3.5; } int lvlLoosers = 0; foreach (Fighter entry in Loosers) { lvlLoosers += entry.Level; } int lvlWinners = 0; foreach (Fighter entry in Winners) { lvlWinners += entry.Level; } double rapport = 1 + ((double)lvlLoosers / (double)lvlWinners); if (rapport <= 1.3) { rapport = 1.3; } /* * if (rapport > 5) * rapport = 5; * //*/ int lvl = G.Level; double rapport2 = 1 + ((double)lvl / (double)lvlWinners); xpWin = (long)(GrouXp * rapport * bonus * taux * coef * rapport2); return(xpWin); }
public override string Compile() { return("gITM" + TaxCollector.parsetoGuild(Guild.ID)); }
protected override void OnTick() { if (m_NextSkillTime != m_From.NextSkillTime || m_NextSpellTime != m_From.NextSpellTime || m_NextActionTime != m_From.NextActionTime) { Stop(); m_From.EndAction(typeof(TreasureMap)); m_Chest.Delete(); } else if (m_LastMoveTime != m_From.LastMoveTime) { m_From.SendLocalizedMessage(503023); // You cannot move around while digging up treasure. You will need to start digging anew. Stop(); m_From.EndAction(typeof(TreasureMap)); m_Chest.Delete(); } /*else if ( !m_Map.CanFit( m_Chest.X, m_Chest.Y, m_Z, 16, true, true ) ) * { * m_From.SendLocalizedMessage( 503024 ); // You stop digging because something is directly on top of the treasure chest. * * Stop(); * m_From.EndAction( typeof( TreasureMap ) ); * m_Chest.Delete(); * }*/ else { m_From.RevealingAction(); m_Count++; m_Chest.Location = new Point3D(m_Chest.Location.X, m_Chest.Location.Y, m_Chest.Location.Z + 1); m_From.Direction = m_From.GetDirectionTo(m_Chest.GetWorldLocation()); if (m_Count == 14) { Stop(); m_From.EndAction(typeof(TreasureMap)); m_TreasureMap.Completed = true; // checks to see if the map is a themed map and if so gets the theme type based on level of map // and sends appropriate theme message/warning // checks to see if the map is a themed map and already has a theme set // and sends appropriate theme message/warning if (themed == true && type != ChestThemeType.None) { m_From.SendMessage(TreasureTheme.GetThemeMessage(type)); } if (m_TreasureMap.Level >= 2) { //generates 1 of the highest mobs for pirate or undead iob chests TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, true); //generates guardian spawn numbers based on if themed or not for (int i = 0; i < TreasureTheme.GetGuardianSpawn(themed, type); ++i) { if (type == ChestThemeType.Undead || type == ChestThemeType.Pirate) { //spawns rest of pirate or undead initial guardian spawn with out highest rank mobs appereing TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, true, false); } else { //not pirate or undead chest spawn as per normal random guardians TreasureTheme.Spawn(m_TreasureMap.Level, m_Chest.Location, m_Chest.Map, null, themed, type, false, false); } } // 25% chance to spawn a a tax collector on a regular chest, 100% on themed chests if (m_TreasureMap.Level > 3 && (Utility.RandomChance(25) || themed == true)) { TaxCollector tc = new TaxCollector(m_Chest); Point3D px = Spawner.GetSpawnPosition(m_Chest.Map, m_Chest.Location, 25, false, true, Spawner.SpawnFlags.SpawnFar, tc); if (px != m_Chest.Location) { // got a good location tc.MoveToWorld(px, m_Chest.Map); } // if we get a tax collector, add a chance to get an additional rare. The chance is calc in the rare drop code // this chest 'hides' another treasure m_Chest.SetFlag(TreasureMapChest.iFlags.Hides, true); } } } else { if (m_From.Body.IsHuman && !m_From.Mounted) { m_From.Animate(11, 5, 1, true, false, 0); } new SoundTimer(m_From, 0x125 + (m_Count % 2)).Start(); } } }
public GuildAttackedTaxcollector(AttackedTaxcollectorState state, TaxCollector percepteur) { this.state = state; this.percepteur = percepteur; }
public TaxCollectorExchange(WorldClient Client, TaxCollector Npc) { this.myClient = Client; this.Npc = Npc; this.ExchangeType = (int)ExchangeTypeEnum.EXCHANGE_TAXCOLLECTOR; }
public static void ProcessExchangeRequest(WorldClient Client, string Packet) { if (!Packet.Contains('|')) { Client.Send(new BasicNoOperationMessage()); return; } var Data = Packet.Substring(2).Split('|'); if (Data.Length != 2) { Client.Send(new BasicNoOperationMessage()); return; } var ExchangeType = 0; long ActorId = 0; if (!int.TryParse(Data[0], out ExchangeType)) { Client.Send(new BasicNoOperationMessage()); return; } if (!Enum.IsDefined(typeof(ExchangeTypeEnum), ExchangeType)) { Client.Send(new BasicNoOperationMessage()); return; } if (!long.TryParse(Data[1], out ActorId) && (ExchangeTypeEnum)ExchangeType != ExchangeTypeEnum.EXCHANGE_MOUNT && (ExchangeTypeEnum)ExchangeType != ExchangeTypeEnum.EXCHANGE_BIGSTORE_BUY && (ExchangeTypeEnum)ExchangeType != ExchangeTypeEnum.EXCHANGE_BIGSTORE_SELL) { Client.Send(new BasicNoOperationMessage()); return; } var Actor = Client.Character.myMap.GetActor(ActorId); // inexistant ? if (Actor == null && (ExchangeTypeEnum)ExchangeType != ExchangeTypeEnum.EXCHANGE_MOUNT && (ExchangeTypeEnum)ExchangeType != ExchangeTypeEnum.EXCHANGE_BIGSTORE_BUY && (ExchangeTypeEnum)ExchangeType != ExchangeTypeEnum.EXCHANGE_BIGSTORE_SELL) { Client.Send(new BasicNoOperationMessage()); return; } // Il peu echanger ? if (!Client.CanGameAction(GameActionTypeEnum.EXCHANGE) && !(Client.GetExchange() != null && Client.GetExchange() is MarketSellExchange && ExchangeType == 11)) { Client.Send(new BasicNoOperationMessage()); return; } switch ((ExchangeTypeEnum)ExchangeType) { case ExchangeTypeEnum.EXCHANGE_BIGSTORE_BUY: if (Client.Character.Deshonor >= 5) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 83)); Client.Send(new ExchangeLeaveMessage()); return; } if (Client.GetExchange() != null) { ProcessExchangeLeaveMessage(Client); } if (!BidHouseTable.Cache.ContainsKey(Client.Character.Map)) { //TODO IM Message HDV Not Exist Client.Send(new ExchangeLeaveMessage()); return; } var Market = BidHouseTable.Cache[Client.Character.Map]; var MbExchange = new MarketBuyExchange(Client, Market); Client.AddGameAction(new GameExchange(Client.Character, MbExchange)); Client.SetExchange(MbExchange); Client.Send(new ExchangeCreateMessage(ExchangeTypeEnum.EXCHANGE_BIGSTORE_BUY, "1,10,100;" + Market.CategoriesString + ";" + Market.TaxRate() + ";" + Market.levelMax + ";" + Market.countItem + ";-1;" + Market.sellTime)); break; case ExchangeTypeEnum.EXCHANGE_SHOP: // lol ? if (Actor.ActorType != GameActorTypeEnum.TYPE_NPC) { Client.Send(new BasicNoOperationMessage()); return; } var Npc = Actor as Npc; var Exchange = new NpcExchange(Client, Npc); Client.AddGameAction(new GameExchange(Client.Character, Exchange)); Client.SetExchange(Exchange); Client.Send(new ExchangeCreateMessage((ExchangeTypeEnum)ExchangeType, Npc.ActorId.ToString())); Client.Send(new ExchangeItemListMessage(Npc)); break; case ExchangeTypeEnum.EXCHANGE_BIGSTORE_SELL: if (Client.Character.Deshonor >= 5) { Client.Send(new TextInformationMessage(TextInformationTypeEnum.ERREUR, 83)); Client.Send(new ExchangeLeaveMessage()); return; } if (!BidHouseTable.Cache.ContainsKey(Client.Character.Map)) { //TODO IM Message HDV Not Exist Client.Send(new ExchangeLeaveMessage()); return; } Market = BidHouseTable.Cache[Client.Character.Map]; var MaExchange = new MarketSellExchange(Client, Market); Client.AddGameAction(new GameExchange(Client.Character, MaExchange)); Client.SetExchange(MaExchange); Client.Send(new ExchangeCreateMessage(ExchangeTypeEnum.EXCHANGE_BIGSTORE_SELL, "1,10,100;" + Market.CategoriesString + ";" + Market.TaxRate() + ";" + Market.levelMax + ";" + Market.countItem + ";-1;" + Market.sellTime)); Client.Send(new ExchangeItemListMessagePerAccount(Client.Account.Data, Market.HdvID)); break; case ExchangeTypeEnum.EXCHANGE_MOUNT: var Mount = Client.Character.Mount; if (Mount == null) { return; } var MExchange = new MountExchange(Client, Mount); Client.AddGameAction(new GameExchange(Client.Character, MExchange)); Client.SetExchange(MExchange); Client.Send(new ExchangeCreateMessage((ExchangeTypeEnum)ExchangeType, Mount.ID.ToString())); Client.Send(new ExchangeMountItemListMessage(Mount)); Client.Send(new MountActualPodMessage(Mount)); break; case ExchangeTypeEnum.EXCHANGE_PLAYER: // lol? if (Actor.ActorType != GameActorTypeEnum.TYPE_CHARACTER) { Client.Send(new BasicNoOperationMessage()); return; } // cast var Target = (Actor as Player).Client; if (!Target.CanGameAction(GameActionTypeEnum.BASIC_REQUEST) || Target.Character.HasRestriction(RestrictionEnum.RESTRICTION_CANT_EXCHANGE) || Client.Character.HasRestriction(RestrictionEnum.RESTRICTION_CANT_EXCHANGE)) { Client.Send(new BasicNoOperationMessage()); return; } var Request = new ExchangeRequest(Client, Target); var RequestAction = new GameRequest(Client.Character, Request); Client.AddGameAction(RequestAction); Target.AddGameAction(RequestAction); Client.SetBaseRequest(Request); Target.SetBaseRequest(Request); var Message = new ExchangeRequestMessage(Client.Character.ID, Target.Character.ID); Client.Send(Message); Target.Send(Message); break; case ExchangeTypeEnum.EXCHANGE_TAXCOLLECTOR: if (Packet.Length < 4 || !Client.Character.HasGuild()) { Client.Send(new BasicNoOperationMessage()); return; } long PercepteurID = long.Parse(Packet.Substring(4)); TaxCollector perco = TaxCollectorTable.GetPerco(PercepteurID); if (perco == null || perco.inFight > 0 || perco.inExchange) { Client.Send(new BasicNoOperationMessage()); return; } perco.inExchange = true; if (Actor.ActorType != GameActorTypeEnum.TYPE_TAX_COLLECTOR) { Client.Send(new BasicNoOperationMessage()); return; } var TC = Actor as TaxCollector; var TExchange = new TaxCollectorExchange(Client, TC); Client.AddGameAction(new GameExchange(Client.Character, TExchange)); Client.SetExchange(TExchange); Client.Send(new ExchangeCreateMessage((ExchangeTypeEnum)ExchangeType, TC.ActorId.ToString())); Client.Send(new ExchangeTaxItemListMessage(TC.SerializeAsItemList())); break; } }
/// <summary> /// Loads the houses and shops. /// </summary> public override void Load() { lock ( locker ) { Houses.Clear(); using (var connection = new MySqlConnection(ConnectionString)) using (var command = QueryCommand(connection, "SELECT * FROM Houses WHERE WorldId = @0", Main.worldID)) using (var reader = command.ExecuteReader()) { while (reader.Read()) { var ownerName = reader.Get <string>("OwnerName"); var name = reader.Get <string>("Name"); var x = reader.Get <int>("X"); var y = reader.Get <int>("Y"); var x2 = reader.Get <int>("X2"); var y2 = reader.Get <int>("Y2"); var debt = (decimal)reader.Get <long>("Debt"); var lastTaxed = DateTime.Parse(reader.Get <string>("LastTaxed")); var forSale = reader.Get <int>("ForSale") == 1; var salePrice = reader.Get <string>("SalePrice"); var house = new House(ownerName, name, x, y, x2, y2) { Debt = debt, LastTaxed = lastTaxed, ForSale = forSale, SalePrice = salePrice }; using (var connection2 = new MySqlConnection(ConnectionString)) using (var command2 = QueryCommand(connection2, "SELECT Username FROM HouseHasUser " + "WHERE OwnerName = @0 AND HouseName = @1 AND WorldId = @2", ownerName, name, Main.worldID)) using (var reader2 = command2.ExecuteReader()) { while (reader2.Read()) { var username = reader2.Get <string>("Username"); house.AllowedUsernames.Add(username); } } Houses.Add(house); } } Shops.Clear(); using (var connection = new MySqlConnection(ConnectionString)) using (var command = QueryCommand(connection, "SELECT * FROM Shops WHERE WorldID = @0", Main.worldID)) using (var reader = command.ExecuteReader()) { while (reader.Read()) { var ownerName = reader.Get <string>("OwnerName"); var name = reader.Get <string>("Name"); var x = reader.Get <int>("X"); var y = reader.Get <int>("Y"); var x2 = reader.Get <int>("X2"); var y2 = reader.Get <int>("X2"); var chestX = reader.Get <int>("ChestX"); var chestY = reader.Get <int>("ChestY"); var isOpen = reader.Get <int>("IsOpen") == 1; var message = reader.Get <string>("Message"); var shop = new Shop(ownerName, name, x, y, x2, y2, chestX, chestY) { IsOpen = isOpen, Message = message }; using (var connection2 = new MySqlConnection(ConnectionString)) using (var command2 = QueryCommand(connection2, "SELECT * FROM ShopHasItem WHERE OwnerName = @0 AND ShopName = @1 AND WorldId = @2", ownerName, name, Main.worldID)) using (var reader2 = command2.ExecuteReader()) { while (reader2.Read()) { var index = reader2.Get <int>("ItemIndex"); var itemId = reader2.Get <int>("ItemId"); var stackSize = reader2.Get <int>("StackSize"); var prefixId = (byte)reader2.Get <int>("PrefixId"); shop.Items.Add(new ShopItem(index, itemId, stackSize, prefixId)); } } using (var connection2 = new MySqlConnection(ConnectionString)) using (var command2 = QueryCommand(connection2, "SELECT * FROM ShopHasPrice WHERE OwnerName = @0 AND ShopName = @1 AND WorldId = @2", ownerName, name, Main.worldID)) using (var reader2 = command2.ExecuteReader()) { while (reader2.Read()) { var itemId = reader2.Get <int>("ItemId"); var unitPriceString = reader2.Get <string>("UnitPrice"); shop.UnitPrices[itemId] = new PriceInfo(unitPriceString); } } Shops.Add(shop); } } //load in tax collectors. TaxCollectors.Clear(); TaxCollectorNames.Clear(); using (var connection = new MySqlConnection(ConnectionString)) using (var command = QueryCommand(connection, "SELECT * FROM TaxCollectors WHERE WorldID = @0", Main.worldID)) using (var reader = command.ExecuteReader()) { while (reader.Read()) { var playerName = reader.Get <string>("PlayerName"); var tc = new TaxCollector(playerName); TaxCollectors.Add(tc); TaxCollectorNames.Add(playerName); } } } }