Ejemplo n.º 1
0
        public override void OnTargeted(Players.Player player, Net.GS.Message.Definitions.World.TargetMessage message)
        {
            NullD.Common.MPQ.FileFormats.TreasureClass Treasure = null;
            if (ActorData.TagMap.ContainsKey(ActorKeys.LootTreasureClass))
            {
                Treasure = (NullD.Common.MPQ.FileFormats.TreasureClass)ActorData.TagMap[ActorKeys.LootTreasureClass].Target;
            }

            if (Treasure != null)
            {
                System.Collections.Generic.List <int> GBids = new System.Collections.Generic.List <int> {
                };
                int LoreSNOId = 0;

                string RawLores = player.Toon.LoreCollected;
                System.Collections.Generic.List <int> Lores = new System.Collections.Generic.List <int> {
                };


                foreach (var Loot in Treasure.LootDropModifiers)
                {
                    if (Loot.ItemSpecifier.ItemGBId != 0)
                    {
                        var ItemDef = Items.ItemGenerator.GetItemDefinition(Loot.ItemSpecifier.ItemGBId);
                        var item    = Items.ItemGenerator.CookFromDefinition(player, ItemDef);
                        LoreSNOId = item.ActorData.TagMap[ActorKeys.Lore].Id;

                        item.Destroy();

                        this.Attributes[GameAttribute.Gizmo_State]  = 1;
                        this.Attributes[GameAttribute.Untargetable] = true;
                        this.Attributes.BroadcastChangedIfRevealed();
                        if (!player.HasLore(LoreSNOId))
                        {
                            player.PlayLore(LoreSNOId, true);
                            player.UpdateExp(300);
                            Logger.Info("Book Implementaion ver 1.0, Получено опыта - 500, Book ID - {0}, Player - {1}", LoreSNOId, player.Toon.Name);
                            break;
                        }
                    }
                }



                //this.Destroy();
            }
            else if (this.ActorSNO.Id == 230232)
            {
                if (!player.HasLore(211567))
                {
                    player.PlayLore(211567, true);
                    player.UpdateExp(500);
                    Logger.Info("Book Implementaion ver 1.0, Получено опыта - 500, Book ID - 211567, Player - {0}", player.Toon.Name);
                }
                this.Attributes[GameAttribute.Gizmo_State]  = 1;
                this.Attributes[GameAttribute.Untargetable] = true;
                this.Attributes.BroadcastChangedIfRevealed();
            }
        }