Esempio n. 1
0
        public L2Npc Spawn(bool notifyOthers = true)
        {
            L2Npc npc;

            if (Type.GetType("L2dotNET.Models.npcs." + Template.Type) != null)
            {
                npc         = (L2Npc)Activator.CreateInstance(Type.GetType("L2dotNET.Models.npcs." + Template.Type), IdFactory.Instance.NextId(), Template);
                npc.X       = Location.X;
                npc.Y       = Location.Y;
                npc.Z       = Location.Z;
                npc.Heading = Location.Heading;
            }
            else
            {
                npc = new L2Npc(IdFactory.Instance.NextId(), Template)
                {
                    X       = Location.X,
                    Y       = Location.Y,
                    Z       = Location.Z,
                    Heading = Location.Heading
                };
            }

            npc.SpawnMe(notifyOthers);
            return(npc);
        }
Esempio n. 2
0
        public void RequestTeleportList(L2Npc npc, L2Player player, int groupId, int itemId)
        {
            if (!_teleports.Npcs.ContainsKey(npc.Template.NpcId))
            {
                player.ShowHtmPlain("no teleports available for you", npc);
                player.SendActionFailed();
                return;
            }

            ABTeleportGroup group = _teleports.Npcs[npc.Template.NpcId].Groups[groupId];
            StringBuilder   sb    = new StringBuilder("&$556;<br><br>");

            foreach (ABTeleportEntry e in group.Teles.Values)
            {
                string cost = string.Empty;
                int    id   = itemId != -1 ? itemId : e.ItemId;
                if (player.Level >= 40)
                {
                    cost = $" - {e.Cost} &#{id};";
                }

                sb.Append($"<a action=\"bypass -h teleport_next?ask={groupId}&reply={e.Id}\" msg=\"811;{e.Name}\">{e.Name}{cost}</a><br1>");
            }

            player.TeleportPayId = itemId;
            player.ShowHtmPlain(sb.ToString(), npc);
        }
Esempio n. 3
0
        public void Initialize()
        {
            string webRootPath = _hostingEnvironment.WebRootPath;

            InitialiseItems(webRootPath);

            var files = Directory.GetFileSystemEntries(webRootPath + "\\xml\\npcs");
            Dictionary <int, L2Npc> npcs = new Dictionary <int, L2Npc>();

            foreach (var file in files)
            {
                var         content = File.ReadAllText(file);
                XmlDocument doc     = new XmlDocument();
                doc.LoadXml(content);
                XmlNodeList xnList = doc.SelectNodes("list/npc"); //.ChildNodes;
                foreach (XmlNode node in xnList)
                {
                    int    id   = int.Parse(node.Attributes["id"].InnerText);
                    string name = node.Attributes["name"].InnerText;
                    var    npc  = new L2Npc
                    {
                        NpcId = id,
                        Name  = name
                    };
                    npcs.Add(id, npc);
                }
            }
            _npcs = new ConcurrentDictionary <int, L2Npc>(npcs);
        }
Esempio n. 4
0
        public override void OnDialog(L2Player player, int ask, int reply, L2Npc npc)
        {
            switch (ask)
            {
            case -1425:
            {
                switch (reply)
                {
                case 1:
                    if (player.Level < 75)
                    {
                        player.ShowHtm(FnLowLevel, npc);
                    }
                    else
                    {
                        if (player.GetAdena() >= 150000)
                        {
                            player.InstantTeleportWithItem(-149406, 255247, -85, 57, 150000);
                        }
                        else
                        {
                            player.ShowHtm(FnNotHaveAdena, npc);
                        }
                    }
                    break;
                }
            }

            break;
            }
        }
Esempio n. 5
0
        public void Buylist(L2Player player, L2Npc trader, short reply)
        {
            if (!Shops.ContainsKey(trader.Template.NpcId))
            {
                player.SendMessage("you shop was not found");
                player.SendActionFailed();
                return;
            }

            NDShop           shop = Shops[trader.Template.NpcId];
            GameserverPacket pk;

            if (!shop.Lists.ContainsKey(reply))
            {
                reply -= 2; // примерка

                if (!shop.Lists.ContainsKey(reply))
                {
                    player.SendMessage($"your shop id was just wrong {reply}");
                    player.SendActionFailed();
                }
                else
                {
                    pk = new ShopPreviewList(player, shop.Lists[reply], reply);
                }
            }
            else
            {
                player.SendPacket(new ExBuySellListBuy(player, shop.Lists[reply], 1.10, 1.0, reply));
                player.SendPacket(new ExBuySellListSell(player));
            }
        }
Esempio n. 6
0
        public L2Npc Spawn(bool notifyOthers = true)
        {
            L2Npc npc;

            if (Type.GetType("L2dotNET.Models.Npcs." + Template.Type) != null)
            {
                //TODO this is shit. Change it
                npc = (L2Npc)Activator.CreateInstance(Type.GetType("L2dotNET.Models.Npcs." + Template.Type),
                                                      _spawnTable, _idFactory.NextId(), Template, this);
                npc.X       = Location.X;
                npc.Y       = Location.Y;
                npc.Z       = Location.Z;
                npc.Heading = Location.Heading;
            }
            else
            {
                npc = new L2Npc(_spawnTable, _idFactory.NextId(), Template, this)
                {
                    X       = Location.X,
                    Y       = Location.Y,
                    Z       = Location.Z,
                    Heading = Location.Heading
                };
            }

            npc.SpawnMeAsync(notifyOthers);
            return(npc);
        }
Esempio n. 7
0
        private void ShowGroup(L2Player player, L2Npc npc, int group)
        {
            List <int[]> ar = _data.Where(d => d[0] == group).ToList();

            string text = $"&$650;<br>{string.Join(string.Empty, ar.Select(val => $"<a action=\"bypass -h menu_select?ask=-3&reply={val[1]}\">&${val[1]};</a><br1>").ToArray())}";

            player.ShowHtmPlain(text, npc);
        }
Esempio n. 8
0
        public override void OnDialog(L2Player player, int ask, int reply, L2Npc npc)
        {
            switch (ask)
            {
            case -2:
                ShowGroup(player, npc, reply);
                break;

            case -3:
                ObserveIt(player, reply);
                break;
            }
        }
Esempio n. 9
0
        public L2Npc Spawn(bool notifyOthers = true)
        {
            L2Npc npc = new L2Npc(IdFactory.Instance.NextId(), Template)
            {
                X       = Location.X,
                Y       = Location.Y,
                Z       = Location.Z,
                Heading = Location.Heading
            };

            npc.SpawnMe(notifyOthers);
            return(npc);
        }
Esempio n. 10
0
        public override void OnShowChat(L2Player player, L2Npc npc)
        {
            List <int> ar = new List <int>();

            foreach (int[] d in _data.Where(d => !ar.Contains(d[0])))
            {
                ar.Add(d[0]);
            }

            string text = string.Join(string.Empty, ar.Select(val => $"<a action=\"bypass -h menu_select?ask=-2&reply={val}\">&${val};</a><br1>").ToArray());

            player.ShowHtmPlain(text, npc);
        }
Esempio n. 11
0
        private L2Npc GetNpc()
        {
            Log.Info($"bypass '{_alias}'");
            L2Npc npc = (L2Npc)_client.CurrentPlayer.Target;

            if (npc != null)
            {
                return(npc);
            }

            _client.CurrentPlayer.SendMessage("no npc found");
            _client.CurrentPlayer.SendActionFailed();
            return(null);
        }
Esempio n. 12
0
        public void RequestTeleport(L2Npc npc, L2Player player, int type, int entryId)
        {
            ABTeleportGroup group;

            try
            {
                group = _teleports.Npcs[npc.Template.NpcId].Groups[type];
            }
            catch
            {
                Log.Error($"ND:RequestTeleport cant find teleport group {type}");
                player.SendActionFailed();
                return;
            }

            ABTeleportEntry e = group.Teles[entryId];

            //if (!player.hasItem(e.itemId, e.cost))
            //{
            //    switch (e.itemId)
            //    {
            //        case 57:
            //            player.sendSystemMessage(SystemMessage.SystemMessageId.YOU_NOT_ENOUGH_ADENA);
            //            break;
            //        case 6651:
            //            player.ShowHtm("fornonoblessitem.htm", npc);
            //            break;

            //        default:
            //            player.sendSystemMessage(SystemMessage.SystemMessageId.NOT_ENOUGH_REQUIRED_ITEMS);
            //            break;
            //    }

            //    player.sendActionFailed();
            //    return;
            //}

            switch (e.ItemId)
            {
            case 57:
                player.ReduceAdena(e.Cost);
                break;

            default:
                player.DestroyItemById(e.ItemId, e.Cost);
                break;
            }
        }
Esempio n. 13
0
        internal void SetNpc(int id)
        {
            if (npcs == null)
            {
                npcs = new SortedList <int, L2Npc>();
            }

            NpcTemplate t   = new NpcTemplate(new StatsSet()); //NpcTable.Instance.GetNpcTemplate(id);
            L2Npc       npc = null;

            switch (t.NpcId)
            {
            case 35461:
                npc = new L2HideoutManager(this);
                break;

            case 35462:
                npc = new L2Doormen(this);
                break;
            }

            //npc.setTemplate(t);
            if (npc == null)
            {
                return;
            }

            StructureSpawn ss = StructureTable.Instance.GetSpawn(id);

            npc.X       = ss.X;
            npc.Y       = ss.Y;
            npc.Z       = ss.Z;
            npc.Heading = ss.Heading;

            npcs.Add(t.NpcId, npc);
        }
Esempio n. 14
0
        public void ShowList(L2Player player, L2Npc npc, int listId)
        {
            if (!Lists.ContainsKey(listId))
            {
                player.SendMessage($"Multsell list #{listId} was not found");
                player.SendActionFailed();
                return;
            }

            MultiSellList list = Lists[listId];

            player.LastRequestedMultiSellId = listId;

            if (list.All == 1)
            {
                player.SendPacket(new MultiSellListEx(list));
                player.CustomMultiSellList = null;
            }
            else
            {
                MultiSellList newlist = new MultiSellList
                {
                    Id = list.Id
                };
                L2Item[] pitems = player.GetAllItems().ToArray();
                foreach (MultiSellEntry entry in list.Container)
                {
                    MultiSellItem msitem = entry.Take[0];

                    if (msitem.Template == null)
                    {
                        continue;
                    }

                    foreach (L2Item item in pitems)
                    {
                        if (item.IsEquipped == 1)
                        {
                            continue;
                        }

                        if (item.Template.ItemId != msitem.Id)
                        {
                            continue;
                        }

                        MultiSellEntry edentry = new MultiSellEntry();
                        edentry.Take.AddRange(entry.Take);
                        edentry.Give.AddRange(entry.Give);

                        edentry.Take[0].L2Item = item;
                        edentry.Give[0].L2Item = item;

                        newlist.Container.Add(edentry);
                    }
                }

                MultiSellListEx mlist = new MultiSellListEx(newlist);
                player.CustomMultiSellList = newlist;
                player.SendPacket(mlist);
            }
        }
Esempio n. 15
0
 public static void CreateClan(L2Player player, string name, L2Npc npc)
 {
 }
Esempio n. 16
0
        public static void OnReply(L2Player player, int reply, L2Npc npc)
        {
            switch (reply)
            {
            case 0:     //new clan
            {
                if (player.Level < 10)
                {
                    player.ShowHtm("pl002.htm", npc);
                    return;
                }

                if (player.Clan != null)
                {
                    if (player.Clan.LeaderId == player.ObjId)
                    {
                        player.ShowHtm("pl003.htm", npc);
                    }
                    else
                    {
                        player.ShowHtm("pl004.htm", npc);
                    }

                    return;
                }

                player.ShowHtm("pl005.htm", npc);
            }

            break;

            case 1:     //Повысить
                player.ShowHtm("pl013.htm", npc);
                break;

            case 2:     //Распустить
                break;

            case 3:     //Восстановить
                break;

            case 4:     //Умения
                break;

            case 5:     //Управлять Академией
                break;

            case 6:     //Управлять Подразделениями Стражей
                break;

            case 9:     //УправлятьПодразделениями Рыцарей
                break;

            case 13:     //.Передать Полномочия Лидера Клана
                break;

            case 100:     //main
                player.ShowHtm("pl001.htm", npc);
                break;
            }
        }
Esempio n. 17
0
 public virtual void OnTalkToNpcQm(L2Player player, L2Npc npc, int reply)
 {
 }
Esempio n. 18
0
 public virtual bool CanTalk(L2Player player, L2Npc npc)
 {
     return(TalkNpcs.Any(id => npc.Template.NpcId == id));
 }
Esempio n. 19
0
 public NpcInfo(L2Npc npc)
 {
     _npc = npc;
 }
Esempio n. 20
0
        public void QuestAccept(L2Player player, L2Npc npc, int questId)
        {
            QuestOrigin qo = Quests[questId];

            qo.OnAccept(player, npc);
        }
Esempio n. 21
0
        public void TalkSelection(L2Player player, L2Npc npc)
        {
            List <object[]> qlist  = new List <object[]>();
            List <int>      ilist  = new List <int>();
            List <int>      clist  = new List <int>();
            bool            nullex = false;

            foreach (QuestInfo qi in player.Quests)
            {
                if (qi.Completed)
                {
                    clist.Add(qi.Id);
                    continue;
                }

                if (!qi.Template.CanTalk(player, npc))
                {
                    continue;
                }

                qlist.Add(new object[] { qi.Template, $"<a action=\"bypass -h quest_continue?quest_id={qi.Id}\">[{qi.Template.QuestName} (In Progress)]</a><br1>", qi.Template.QuestId });
                ilist.Add(qi.Id);
            }

            foreach (QuestOrigin qo in Quests.Values.Where(qo => !ilist.Contains(qo.QuestId)).Where(qo => qo.StartNpc == npc.Template.NpcId))
            {
                if (clist.Contains(qo.QuestId))
                {
                    qlist.Add(new object[] { null, $"[{qo.QuestName} (Completed)]<br1>", 0 });
                    nullex = true;
                    continue;
                }

                qlist.Add(new object[] { qo, $"<a action=\"bypass -h quest_tryaccept?quest_id={qo.QuestId}\">[{qo.QuestName}]</a><br1>", qo.QuestId });
            }

            if (!nullex && (qlist.Count == 1))
            {
                foreach (object[] o in qlist)
                {
                    if (((string)o[1]).Contains("(In Progress)"))
                    {
                        player.quest_Talk(npc, ((QuestOrigin)o[0]).QuestId);
                    }
                    else
                    {
                        ((QuestOrigin)o[0]).TryAccept(player, npc);
                    }
                }

                return;
            }

            if (qlist.Count == 0)
            {
                player.ShowHtmPlain("No quests for you now. Talk to others", npc);
                return;
            }

            StringBuilder sb = new StringBuilder();

            foreach (object[] ur in qlist)
            {
                sb.Append((string)ur[1]);
            }

            player.ShowHtmPlain(sb.ToString(), npc);

            qlist.Clear();
            ilist.Clear();
            clist.Clear();
        }
Esempio n. 22
0
 internal void Preview(L2Player talker, L2Npc myself, int p)
 {
     throw new NotImplementedException();
 }
Esempio n. 23
0
 public virtual void TryAccept(L2Player player, L2Npc npc)
 {
 }
Esempio n. 24
0
        public override void RunImpl()
        {
            L2Player player = _client.CurrentPlayer;

            if (_count <= 0)
            {
                player.SendActionFailed();
                return;
            }

            L2Npc trader = player.FolkNpc;

            if (trader == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.TradeAttemptFailed);
                player.SendActionFailed();
                return;
            }

            NDShop shop = NpcData.Instance.Shops[trader.Template.NpcId];

            if (shop == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.TradeAttemptFailed);
                player.SendActionFailed();
                return;
            }

            NdShopList list = shop.Lists[(short)_listId];

            if (list == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.TradeAttemptFailed);
                player.SendActionFailed();
                return;
            }

            int adena  = 0;
            int slots  = 0,
                weight = 0;

            for (int i = 0; i < _count; i++)
            {
                int itemId = _items[i * 2];

                bool notfound = true;
                foreach (NDShopItem item in list.Items.Where(item => item.Item.ItemId == itemId))
                {
                    adena += item.Item.ReferencePrice * _items[(i * 2) + 1];

                    if (!item.Item.Stackable)
                    {
                        slots++;
                    }
                    //else
                    //{
                    //    if (!player.HasItem(item.item.ItemID))
                    //        slots++;
                    //}

                    weight += item.Item.Weight * _items[(i * 2) + 1];

                    notfound = false;
                    break;
                }

                if (!notfound)
                {
                    continue;
                }

                player.SendSystemMessage(SystemMessage.SystemMessageId.TradeAttemptFailed);
                player.SendActionFailed();
                return;
            }

            if (adena > player.GetAdena())
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.YouNotEnoughAdena);
                return;
            }

            player.ReduceAdena(adena);

            for (int i = 0; i < _count; i++)
            {
                int itemId = _items[i * 2];
                int count  = _items[(i * 2) + 1];

                player.AddItem(itemId, count);
            }

            player.SendPacket(new ExBuySellListClose());
        }
Esempio n. 25
0
 public void RequestTeleportList(L2Npc npc, L2Player player, int groupId)
 {
     RequestTeleportList(npc, player, groupId, -1);
 }
        public override void RunImpl()
        {
            L2Player player = _client.CurrentPlayer;
            L2Npc    npc    = player.FolkNpc;

            if (npc == null)
            {
                player.SendActionFailed();
                return;
            }

            int slots = 0;

            for (int i = 0; i < _count; i++)
            {
                int objectId = _items[i * 2];
                int count    = _items[(i * 2) + 1];

                L2Item item = null; //player._warehouse.Items[objectId];

                if (item == null)
                {
                    Log.Info($"cant find item {objectId} in warehouse {player.Name}");
                    player.SendActionFailed();
                    return;
                }

                if (item.Template.Stackable)
                {
                    slots += 1;
                }
                else
                {
                    slots += count;
                }
            }

            //InvPrivateWarehouse pw = player._warehouse ?? new InvPrivateWarehouse(player);
            //int itsize = 0;
            //else
            //    itsize = pw.Items.Count;

            if (player.ItemLimitInventory < (player.GetAllItems().Count + slots))
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.SlotsFull);
                player.SendActionFailed();
                return;
            }

            List <int[]> transfer = new List <int[]>();

            for (int i = 0; i < _count; i++)
            {
                int objectId = _items[i * 2];
                int count    = _items[(i * 2) + 1];

                transfer.Add(new[] { objectId, count });
            }

            //pw.transferFrom(player, transfer, false);

            //if(npc.Template.fnBye != null)
            //{
            //    player.sendPacket(new NpcHtmlMessage(player, npc.Template.fnBye, npc.ObjID, 0));
            //}

            player.SendItemList(true);
        }
Esempio n. 27
0
        public Packet NpcInfo(L2Npc npc)
        {
            byte   opcode = 0x16;
            Packet p      = new Packet(opcode);

            p.WriteInt(npc.ObjId);
            p.WriteInt(npc.NpcTemplate.NpcId + 1000000);
            p.WriteInt(0);
            p.WriteInt((int)npc.Position.x);
            p.WriteInt((int)npc.Position.y);
            p.WriteInt((int)npc.Position.z);
            p.WriteInt(0);
            p.WriteInt(0x00);

            double spd    = 150;  //_npc.CharacterStat.GetStat(EffectType.PSpeed);
            double atkspd = 1200; //_npc.CharacterStat.GetStat(EffectType.BAttackSpd);
            double cast   = 1200; //_npc.CharacterStat.GetStat(EffectType.BCastingSpd);
            double anim   = (spd * 1f) / 120;
            double anim2  = (1.1 * atkspd) / 277;

            p.WriteInt((int)cast);
            p.WriteInt((int)atkspd);
            p.WriteInt((int)spd);
            p.WriteInt((int)(spd * .8));
            p.WriteInt(0); // swimspeed
            p.WriteInt(0); // swimspeed
            p.WriteInt(0);
            p.WriteInt(0);
            p.WriteInt(0);
            p.WriteInt(0);

            p.WriteDouble(anim);
            p.WriteDouble(anim2);
            p.WriteDouble(npc.NpcTemplate.CollisionRadius);
            p.WriteDouble(npc.NpcTemplate.CollisionHeight);
            p.WriteInt(0);  // right hand weapon
            p.WriteInt(0);
            p.WriteInt(0);  // left hand weapon
            p.WriteByte(1); // name above char 1=true ... ??
            p.WriteByte(0);
            p.WriteByte(0);
            p.WriteByte(0);
            p.WriteByte(0); // invisible ?? 0=false  1=true   2=summoned (only works if model has a summon animation)
            p.WriteString(npc.Name);
            p.WriteString(npc.Title);
            p.WriteInt(0x00); // Title color 0=client default
            p.WriteInt(0x00); //pvp flag
            p.WriteInt(0x00); // karma

            p.WriteInt(0);
            p.WriteInt(0);  //_npc.ClanId
            p.WriteInt(0);  //_npc.ClanCrestId
            p.WriteInt(0);  //_npc.AllianceId
            p.WriteInt(0);  //_npc.AllianceCrestId
            p.WriteByte(0); // C2

            p.WriteByte(0);
            p.WriteDouble(13);
            p.WriteDouble(11.5);
            p.WriteInt(0); // enchant
            p.WriteInt(0); // C6

            return(p);
        }
Esempio n. 28
0
        public override async Task RunImpl()
        {
            await Task.Run(() =>
            {
                L2Player player = _client.CurrentPlayer;
                L2Npc npc       = player.FolkNpc;

                if (npc == null)
                {
                    player.SendActionFailedAsync();
                    return;
                }

                int totalCost = 0;
                int weight    = 0;
                for (int i = 0; i < _count; i++)
                {
                    int objectId = _items[(i * 3) + 0];
                    int count    = _items[(i * 3) + 2];

                    //if ((count < 0) || (count > int.MaxValue))
                    if (count < 0)
                    {
                        player.SendSystemMessage(SystemMessage.SystemMessageId.SellAttemptFailed);
                        player.SendActionFailedAsync();
                        return;
                    }

                    L2Item item = player.Inventory.Items[objectId];

                    if (item.Template.Stackable)
                    {
                        totalCost += (int)(item.Count * (item.Template.ReferencePrice * .5));
                    }
                    else
                    {
                        totalCost += (int)(item.Template.ReferencePrice * .5);
                    }

                    weight += item.Template.Weight;
                }

                //if (totalCost > long.MaxValue)
                //{
                //    player.sendSystemMessage(SystemMessage.SystemMessageId.SELL_ATTEMPT_FAILED);
                //    player.sendActionFailed();
                //    return;
                //}

                int added,
                currentAdena = player.GetAdena();
                if ((currentAdena + totalCost) >= int.MaxValue)
                {
                    added = int.MaxValue - currentAdena;
                }
                else
                {
                    added = totalCost;
                }

                List <int[]> transfer = new List <int[]>();
                //InventoryUpdate iu = new InventoryUpdate();
                for (int i = 0; i < _count; i++)
                {
                    int objectId = _items[(i * 3) + 0];
                    int count    = _items[(i * 3) + 2];

                    transfer.Add(new[] { objectId, count });
                }

                //player.Refund.transferHere(player, transfer, false);
                //player.Refund.validate();

                player.AddAdena(added, true);
                player.SendItemList(true);
                player.SendPacketAsync(new ExBuySellListClose());

                if (weight != 0)
                {
                    player.UpdateWeight();
                }

                //if (npc.Template.fnSell != null)
                //{
                //    player.sendPacket(new NpcHtmlMessage(player, npc.Template.fnSell, npc.ObjID, 0));
                //}
            });
        }
Esempio n. 29
0
 public virtual void OnTalkToNpc(L2Player player, L2Npc npc, int stage)
 {
 }
Esempio n. 30
0
        public override async Task RunImpl()
        {
            await Task.Run(() =>
            {
                L2Player player = _client.CurrentPlayer;

                L2Npc npc = player.FolkNpc;

                if (npc == null)
                {
                    player.SendActionFailedAsync();
                    return;
                }

                int fee           = _count * 30;
                int slots         = 0;
                int adenatransfer = 0;
                for (int i = 0; i < _count; i++)
                {
                    int objectId = _items[i * 2];
                    int count    = _items[(i * 2) + 1];

                    L2Item item = player.GetItemByObjId(objectId);

                    if (item == null)
                    {
                        Log.Info($"cant find item {objectId} in inventory {player.Name}");
                        player.SendActionFailedAsync();
                        return;
                    }

                    if (item.Template.Stackable)
                    {
                        slots += 1;
                    }
                    else
                    {
                        slots += count;
                    }

                    if (item.Template.ItemId == 57)
                    {
                        adenatransfer += count;
                    }
                }

                if ((player.GetAdena() - adenatransfer) < fee)
                {
                    player.SendSystemMessage(SystemMessage.SystemMessageId.YouNotEnoughAdenaPayFee);
                    player.SendActionFailedAsync();
                    return;
                }

                //InvPrivateWarehouse pw = player._warehouse;
                //int itsize = 0;
                //if (pw == null)
                //    pw = new InvPrivateWarehouse(player);
                //else
                //    itsize = pw.Items.Count;

                //if (player.ItemLimit_Warehouse < (itsize + slots))
                //{
                //    player.sendSystemMessage(SystemMessage.SystemMessageId.WAREHOUSE_FULL);
                //    player.sendActionFailed();
                //    return;
                //}

                player.ReduceAdena(fee);

                List <int[]> transfer = new List <int[]>();
                for (int i = 0; i < _count; i++)
                {
                    int objectId = _items[i * 2];
                    int count    = _items[(i * 2) + 1];

                    transfer.Add(new[] { objectId, count });
                }

                // pw.transferHere(player, transfer, false);

                //if(npc.Template.fnBye != null)
                //{
                //    player.sendPacket(new NpcHtmlMessage(player, npc.Template.fnBye, npc.ObjID, 0));
                //}

                player.SendItemList(true);
            });
        }
Esempio n. 31
0
 void DrawNpc(Graphics g, L2Npc npc, int x, int y, int width)
 {
     if (Settings.ObjectsList.ShowMP)
     {
         hpBar5.Draw(g, x + 12, y + 1, npc.CurHP, npc.MaxHP);
         mpBar5.Draw(g, x + 12, y + 6, npc.CurMP, npc.MaxMP);
     }
     else
         hpBar.Draw(g, x + 12, y + 1, npc.CurHP, npc.MaxHP);
     g.DrawString(npc.Name, GUI.Font, GUI.NpcBrush, x + 84, y);
 }