コード例 #1
0
            public void OnCommand(GameClient client, string[] args)
            {
                try
                {
                    for (int x = 0; x < 8; x++)
                    {
                        GeneratedUniqueItem item = null;

                        if (args.Length > 1)
                        {
                            if (Convert.ToString(args[1]).ToUpper() == "TOA")
                            {
                                item = new GeneratedUniqueItem(true, client.Player.Realm, 51);
                                item.GenerateItemQuality(GameObject.GetConLevel(client.Player.Level, 60));
                            }
                            else if (Convert.ToString(args[1]).ToUpper() == "L51")
                            {
                                item = new GeneratedUniqueItem(client.Player.Realm, 51);
                                item.GenerateItemQuality(GameObject.GetConLevel(client.Player.Level, 50));
                            }
                            else
                            {
                                if (args.Length > 2)
                                {
                                    item = new GeneratedUniqueItem(client.Player.Realm, client.Player.Level, (eObjectType)Convert.ToInt32(args[1]), (eInventorySlot)Convert.ToInt32(args[2]));
                                }
                                else
                                {
                                    item = new GeneratedUniqueItem(client.Player.Realm, client.Player.Level, (eObjectType)Convert.ToInt32(args[1]));
                                }
                            }
                        }

                        item.AllowAdd = true;
                        GameServer.Database.AddObject(item);
                        InventoryItem invitem = GameInventoryItem.Create <ItemUnique>(item);
                        client.Player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, invitem);
                        client.Player.Out.SendMessage("Generated: " + item.Name, eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    }
                }
                catch (Exception)
                {
                    DisplaySyntax(client);
                }
            }
コード例 #2
0
        /// <summary>
        /// Generate loot for given mob
        /// </summary>
        /// <param name="mob"></param>
        /// <returns></returns>
        public override LootList GenerateLoot(GameNPC mob, GameObject killer)
        {
            LootList loot = base.GenerateLoot(mob, killer);


            try
            {
                GamePlayer player = killer as GamePlayer;
                if (killer is GameNPC && ((GameNPC)killer).Brain is IControlledBrain)
                {
                    player = ((ControlledNpcBrain)((GameNPC)killer).Brain).GetPlayerOwner();
                }
                if (player == null)
                {
                    return(loot);
                }

                // allow the leader to decide the loot realm
                if (player.Group != null)
                {
                    player = player.Group.Leader;
                }

                double killedCon = player.GetConLevel(mob);

                //grey don't loot RoG
                if (killedCon <= -3)
                {
                    return(loot);
                }

                // chance to get a RoG Item
                int chance = BASE_ROG_CHANCE + ((int)killedCon + 3) * 2;
                // toa item
                bool toachance = Util.Chance(BASE_TOA_CHANCE);

                if (IsMobInTOA(mob) && mob.Name.ToLower() != mob.Name && mob.Level >= 50)
                {
                    // ToA named mobs have good chance to drop unique loot
                    chance   += NAMED_ROG_CHANCE + NAMED_TOA_CHANCE;
                    toachance = true;
                }
                else if (IsMobInTOA(mob))
                {
                    toachance = true;
                }
                else if (mob.Name.ToLower() != mob.Name)
                {
                    chance += NAMED_ROG_CHANCE;
                }

                GeneratedUniqueItem item = new GeneratedUniqueItem(toachance, player.Realm, (byte)Math.Min(mob.Level + 1, 51));
                item.AllowAdd = true;
                item.GenerateItemQuality(killedCon);

                if (player.Realm != 0)
                {
                    loot.AddRandom(chance, item, 1);
                }
            }
            catch
            {
                return(loot);
            }

            return(loot);
        }