コード例 #1
0
ファイル: NPCCommand.cs プロジェクト: 0xFh/Asda2-Project
 public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
 {
     if (trigger.Args.Character.Target == null)
     {
         trigger.Reply("Select target.");
     }
     else
     {
         NPC target = trigger.Args.Character.Target as NPC;
         if (target == null)
         {
             trigger.Reply("You must select a monstr.");
         }
         else
         {
             trigger.Reply("Target is {0},", (object)target);
             foreach (Asda2LootItemEntry entry in Asda2LootMgr.GetEntries(Asda2LootEntryType.Npc,
                                                                          target.EntryId))
             {
                 trigger.Reply("{0} [{1}] [{2}-{3}] [{4}]", (object)entry.ItemId,
                               (object)(int)entry.ItemId, (object)entry.MinAmount, (object)entry.MaxAmount,
                               (object)entry.DropChance.ToString(CultureInfo.InvariantCulture)
                               .Replace('0', 'O'), (object)entry.RequiredQuestId);
             }
         }
     }
 }
コード例 #2
0
ファイル: GOEntry.cs プロジェクト: 0xFh/Asda2-Project
 public override List <Asda2LootItemEntry> GetLootEntries()
 {
     if (this is IGOLootableEntry)
     {
         return(Asda2LootMgr.GetEntries(Asda2LootEntryType.Npc, Id));
     }
     return(null);
 }
コード例 #3
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                if (Asda2LootMgr.Loaded)
                {
                    trigger.Reply("Loot has already been loaded. Clearing and reloading");
                    Asda2LootMgr.ClearLootData();
                }

                ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() =>
                {
                    trigger.Reply("Loading Loot...");
                    Asda2LootMgr.LoadAll();
                    trigger.Reply("Done.");
                }));
            }
コード例 #4
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                if (trigger.Args.Character.Target == null)
                {
                    trigger.Reply("Select target.");
                    return;
                }

                var target = trigger.Args.Character.Target as NPC;

                if (target == null)
                {
                    trigger.Reply("You must select a monstr.");
                    return;
                }
                trigger.Reply("Target is {0},", target);
                var loot = Asda2LootMgr.GetEntries(Asda2LootEntryType.Npc, target.EntryId);

                foreach (var item in loot)
                {
                    trigger.Reply("{0} [{1}] [{2}-{3}] [{4}]", item.ItemId, (int)item.ItemId, item.MinAmount, item.MaxAmount, item.DropChance.ToString(System.Globalization.CultureInfo.InvariantCulture).Replace('0', 'O'), item.RequiredQuestId);
                }
            }
コード例 #5
0
ファイル: EventCommand.cs プロジェクト: uvbs/Asda2-Server
 public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
 {
     Asda2LootMgr.EnableLuckyDropEvent();
     trigger.Reply("done");
 }
コード例 #6
0
 public override List <Asda2LootItemEntry> GetLootEntries()
 {
     return(Asda2LootMgr.GetEntries(Asda2LootEntryType.Npc, Id));
 }
コード例 #7
0
            public virtual void LoadAll(CmdTrigger <RealmServerCmdArgs> trigger, bool force)
            {
                DateTime now = DateTime.Now;

                try
                {
                    if (ItemMgr.Loaded)
                    {
                        trigger.Reply("Item definitions have already been loaded.");
                    }
                    else
                    {
                        trigger.Reply("Loading Items...");
                        ItemMgr.LoadAll();
                        trigger.Reply("Done.");
                    }
                }
                catch (Exception ex)
                {
                    this.FailNotify(trigger, ex);
                }

                try
                {
                    if (NPCMgr.Loaded)
                    {
                        trigger.Reply("NPC definitions have already been loaded.");
                    }
                    else
                    {
                        trigger.Reply("Loading NPCs...");
                        NPCMgr.LoadNPCDefs(force);
                        trigger.Reply("Done.");
                    }
                }
                catch (Exception ex)
                {
                    this.FailNotify(trigger, ex);
                }

                try
                {
                    if (GOMgr.Loaded)
                    {
                        trigger.Reply("GO definitions have already been loaded.");
                    }
                    else
                    {
                        trigger.Reply("Loading GOs...");
                        GOMgr.LoadAll();
                        trigger.Reply("Done.");
                    }
                }
                catch (Exception ex)
                {
                    this.FailNotify(trigger, ex);
                }

                try
                {
                    if (QuestMgr.Loaded)
                    {
                        trigger.Reply("Quest definitions have already been loaded.");
                    }
                    else
                    {
                        trigger.Reply("Loading Quests...");
                        QuestMgr.LoadAll();
                        trigger.Reply("Done.");
                    }
                }
                catch (Exception ex)
                {
                    this.FailNotify(trigger, ex);
                }

                try
                {
                    if (Asda2LootMgr.Loaded)
                    {
                        trigger.Reply("Loot has already been loaded.");
                    }
                    else
                    {
                        trigger.Reply("Loading Loot...");
                        Asda2LootMgr.LoadAll();
                        trigger.Reply("Done.");
                    }
                }
                catch (Exception ex)
                {
                    this.FailNotify(trigger, ex);
                }

                trigger.Reply("All done - Loading took: " + (object)(DateTime.Now - now));
                GC.Collect(2, GCCollectionMode.Optimized);
                if (!Map.AutoSpawnMaps)
                {
                    return;
                }
                MapCommand.MapSpawnCommand.SpawnAllMaps(trigger);
            }
コード例 #8
0
ファイル: NPC.cs プロジェクト: 0xFh/Asda2-Project
        protected override void OnDeath()
        {
            if (m_brain != null)
            {
                m_brain.IsRunning = false;
            }

            if (m_Map != null || this != null)
            {
                var       rcvrs  = this.GetNearbyClients(false);
                var       looter = CalcLooter();
                Asda2Loot loot   = null;
                if (looter != null && m_Map.DefenceTownEvent == null)
                {
                    loot = Asda2LootMgr.GetOrCreateLoot(this, looter,
                                                        Asda2LootEntryType.Npc);
                    if (loot != null && Template != null)
                    {
                        loot.MonstrId = (short?)Template.Id;
                    }
                }



                Loot = null;
                var map = m_Map;
                m_Map.CallDelayed(LastDamageDelay, () =>
                {
                    Asda2CombatHandler.SendMostrDeadToAreaResponse(rcvrs,
                                                                   (short)
                                                                   UniqIdOnMap,
                                                                   (short)
                                                                   Asda2Position.
                                                                   X,
                                                                   (short)
                                                                   Asda2Position.
                                                                   Y);
                    map.OnNPCDied(this);

                    var chr = LastKiller as Character;
                    if (chr != null)
                    {
                        Asda2TitleChecker.OnNpcDeath(this, chr);
                        if (chr.IsInGroup)
                        {
                            chr.Group.ForeachCharacter(x => KillMonsterEventManager.TryGiveReward(x, Template.Id));
                        }
                        else
                        {
                            KillMonsterEventManager.TryGiveReward(chr, Template.Id);
                        }
                    }
                    if (loot != null && loot.Lootable is NPC)
                    {
                        var npc = ((NPC)loot.Lootable);
                        if (npc != null && npc.Map != null)
                        {
                            npc.Map.SpawnLoot(loot);
                        }
                    }

                    if (m_entry != null && Entry != null && Template != null)
                    {
                        if (Entry.Rank >= CreatureRank.Boss)
                        {
                            if (LastKiller != null)
                            {
                                ChatMgr.SendGlobalMessageResponse(LastKiller.Name,
                                                                  ChatMgr.Asda2GlobalMessageType
                                                                  .HasDefeated, 0, 0,
                                                                  (short)Template.Id);
                            }
                            if (chr != null)
                            {
                                chr.GuildPoints += m_entry.MinLevel * CharacterFormulas.BossKillingGuildPointsPerLevel;
                            }
                        }
                        else
                        {
                            if (chr != null && chr.Level < m_entry.MinLevel + 3)
                            {
                                chr.GuildPoints += CharacterFormulas.MobKillingGuildPoints;
                            }
                        }
                        // notify events
                        m_entry.NotifyDied(this);
                    }
                    EnterFinalState();
                });
            }


            //UnitFlags |= UnitFlags.SelectableNotAttackable;

            // send off the tamer
            if (m_currentTamer != null)
            {
                PetHandler.SendTameFailure(m_currentTamer, TameFailReason.TargetDead);
                CurrentTamer.SpellCast.Cancel(SpellFailedReason.Ok);
            }

            // reset spawn timer
            if (m_spawnPoint != null)
            {
                m_spawnPoint.SignalSpawnlingDied(this);
            }
        }