Пример #1
0
        public override void onTeleportRequest(L2Player player)
        {
            if (hideout.NoTeleports)
            {
                player.sendPacket(new NpcHtmlMessage(player, ai.fnTeleportLevelZero, ObjID));
                return;
            }

            int level = hideout.GetFuncLevel(AgitManagerAI.decotype_teleport);

            if (level == 0)
            {
                player.sendPacket(new NpcHtmlMessage(player, ai.fnFuncDisabled, ObjID));
            }
            else
            {
                NpcData.getInstance().RequestTeleportList(this, player, level);
            }
        }
Пример #2
0
 public void UseTeleporter(L2Player player, int type, int entryId)
 {
     NpcData.getInstance().RequestTeleport(this, player, type, entryId);
 }
Пример #3
0
 public virtual void onTeleportRequest(L2Player player)
 {
     NpcData.getInstance().RequestTeleportList(this, player, 1);
 }
Пример #4
0
        public virtual void onDialog(L2Player player, int ask, int reply)
        {
            player.FolkNpc = this;

            AIProcessor.TalkedReply(player, ask, reply);
            return;

            if (ask > 0 && ask < 1000)
            {
                QuestManager.getInstance().onQuestTalk(player, this, ask, reply);
                return;
            }

            AITemplate t = AIManager.getInstance().checkDialogResult(Template.NpcId);

            if (t != null)
            {
                t.onDialog(player, ask, reply, this);
                return;
            }

            switch (ask)
            {
            case -1:
                switch (reply)
                {
                case 8:
                    player.sendPacket(new ExBuySellList_Buy(player.getAdena()));
                    player.sendPacket(new ExBuySellList_Sell(player));
                    break;

                default:
                    NpcData.getInstance().buylist(player, this, (short)reply);
                    break;
                }
                break;

            case -3:
                grandmaster_total.onReply(player, reply, this);
                break;

            case -19:     //нобл запрос
                switch (reply)
                {
                case 0:
                case 1:
                    player.ShowHtm(player.Noblesse == 1 ? "fornobless.htm" : "fornonobless.htm", this);
                    break;
                }
                break;

            case -20:     //нобл запрос
                switch (reply)
                {
                case 2:
                    NpcData.getInstance().RequestTeleportList(this, player, 2);
                    break;
                }
                break;

            case -21:     //нобл запрос
                switch (reply)
                {
                case 2:
                    NpcData.getInstance().RequestTeleportList(this, player, 3);
                    break;
                }
                break;

            case -22:     //нобл запрос
                switch (reply)
                {
                case 2:
                    NpcData.getInstance().RequestTeleportList(this, player, 1);
                    break;
                }
                break;

            case -303:
                MultiSell.getInstance().showList(player, this, reply);
                break;

            case -305:
                switch (reply)
                {
                case 1:
                    //  NpcData.getInstance().multisell(player, this, reply); //TEST
                    break;
                }
                break;

            case -1000:
            {
                switch (reply)
                {
                case 1:
                    //See the lord and get the tax rate information
                    break;
                }
            }
            break;
            }
        }
Пример #5
0
        public override void run()
        {
            L2Player player = getClient().CurrentPlayer;

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

            L2Citizen trader = player.FolkNpc;

            if (trader == null)
            {
                player.sendSystemMessage(1802); //The attempt to trade has failed.
                player.sendActionFailed();
                return;
            }

            ND_shop shop = NpcData.getInstance()._shops[trader.Template.NpcId];

            if (shop == null)
            {
                player.sendSystemMessage(1802); //The attempt to trade has failed.
                player.sendActionFailed();
                return;
            }

            ND_shopList list = shop.lists[(short)_listId];

            if (list == null)
            {
                player.sendSystemMessage(1802); //The attempt to trade has failed.
                player.sendActionFailed();
                return;
            }

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

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

                bool notfound = true;
                foreach (ND_shopItem item in list.items)
                {
                    if (item.item.ItemID == itemId)
                    {
                        adena += item.item.Price * _items[i * 2 + 1];

                        if (!item.item.isStackable())
                        {
                            slots++;
                        }
                        else
                        {
                            if (!player.hasItem(item.item.ItemID))
                            {
                                slots++;
                            }
                        }

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

                        notfound = false;
                        break;
                    }
                }

                if (notfound)
                {
                    player.sendSystemMessage(1802); //The attempt to trade has failed.
                    player.sendActionFailed();
                    return;
                }
            }

            if (adena > player.getAdena())
            {
                player.sendSystemMessage(279); //You do not have enough adena.
                return;
            }

            player.reduceAdena(adena, false, false);

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

                player.Inventory.addItem(itemId, count, false, false);
            }

            player.sendPacket(new ExBuySellList_Close());
        }
Пример #6
0
        public void Start()
        {
            Console.Title = "L2dotNET Gameserver";

            CLogger.form();
            Cfg.init("all");

            CharTemplateTable.Instance.Initialize();

            NetworkBlock.Instance.Initialize();
            GameTime.Instance.Initialize();

            IdFactory.Instance.Initialize();

            L2World.Instance.Initialize();

            MapRegionTable.Instance.Initialize();
            ZoneTable.Instance.Initialize();

            NpcTable.Instance.Initialize();
            NpcData.getInstance();
            //  SpawnTable.getInstance();

            //  TSkillTable.getInstance();
            ItemTable.getInstance();
            ItemHandler.getInstance();
            MultiSell.getInstance();
            Capsule.getInstance();
            RecipeTable.getInstance();

            AIManager.getInstance();

            BlowFishKeygen.GenerateKeys();
            CLogger.info("Generated 20 Blowfish Keys");

            AdminAccess.Instance.Initialize();;

            QuestManager.getInstance();

            AnnouncementManager.Instance.Initialize();

            AllianceTable.getInstance();
            ClanTable.getInstance();

            CLogger.info("NpcServer: ");
            StaticObjTable.Instance.Initialize();
            MonsterRace.Instance.Initialize();
            //  SpawnTable.getInstance().Spawn();
            StructureTable.Instance.Initialize();

            HtmCache.Instance.Initialize();

            AuthThread.Instance.Initialize();

            //   GeoData.getInstance();

            CLogger.extra_info("Listening Gameservers on port " + Cfg.SERVER_PORT);
            _listener = new TcpListener(IPAddress.Any, Cfg.SERVER_PORT);
            _listener.Start();

            TcpClient clientSocket = default(TcpClient);

            while (true)
            {
                clientSocket = _listener.AcceptTcpClient();
                Accept(clientSocket);
            }
        }
Пример #7
0
        public override void TalkedReply(L2Player talker, int ask, int reply)
        {
            if (ask == -1)
            {
                switch (reply)
                {
                case 0: NpcData.getInstance().buylist(talker, myself, 0);
                    break;

                case 1: NpcData.getInstance().buylist(talker, myself, 1);
                    break;

                case 2: NpcData.getInstance().preview(talker, myself, 2);
                    break;

                case 3: NpcData.getInstance().preview(talker, myself, 3);
                    break;

                case 4: NpcData.getInstance().buylist(talker, myself, 4);
                    break;

                case 5: NpcData.getInstance().buylist(talker, myself, 5);
                    break;

                case 6: NpcData.getInstance().preview(talker, myself, 6);
                    break;

                case 7: NpcData.getInstance().preview(talker, myself, 7);
                    break;

                case 8:
                    talker.sendPacket(new ExBuySellList_Buy(talker.getAdena()));
                    talker.sendPacket(new ExBuySellList_Sell(talker));
                    break;
                }
            }
            else if (ask == -506)
            {
                MultiSell.getInstance().showList(talker, myself, 212);
            }
            else if (ask == -507)
            {
                MultiSell.getInstance().showList(talker, myself, 221);
            }
            else if (ask == -510)
            {
                if (reply == 1)
                {
                    if (talker.Level < 40)
                    {
                        talker.ShowHtm("reflect_weapon_none.htm", myself);
                    }
                    else if (talker.Level >= 40 && talker.Level < 46)
                    {
                        talker.ShowHtm("reflect_weapon_d.htm", myself);
                    }
                    else if (talker.Level >= 46 && talker.Level < 52)
                    {
                        talker.ShowHtm("reflect_weapon_c.htm", myself);
                    }
                    else if (talker.Level >= 52)
                    {
                        talker.ShowHtm("reflect_weapon_b.htm", myself);
                    }
                }
            }
            else
            {
                base.TalkedReply(talker, ask, reply);
            }
        }
Пример #8
0
        public override void onDialog(L2Player player, int ask, int reply)
        {
            player.FolkNpc = this;
            short result = 0;

            switch (ask)
            {
            case 0:
                NotifyAction(player);
                break;

            case -201:
                switch (reply)
                {
                case 0:
                    NotifyAction(player);
                    break;

                case 1:                                       //doors
                    if (player.Clan.LeaderID == player.ObjID) //TODO privs
                    {
                        player.sendPacket(new NpcHtmlMessage(player, ai.fnDoor, ObjID));
                    }
                    else
                    {
                        player.teleport(hideout.outsideLoc[0], hideout.outsideLoc[1], hideout.outsideLoc[2]);
                    }
                    break;

                case 2:         //banish
                    player.sendPacket(new NpcHtmlMessage(player, ai.fnBanish, ObjID));
                    break;

                case 3:         //functions
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnDecoFunction, ObjID);
                    htm.replace("<?HPDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_hpregen));
                    htm.replace("<?MPDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_mpregen));
                    htm.replace("<?XPDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_xprestore));
                    player.sendPacket(htm);
                }
                break;

                case 4:         // warehouse
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnWarehouse, ObjID);
                    htm.replace("<?agit_lease?>", hideout.RentCost);
                    htm.replace("<?pay_time?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    player.sendPacket(htm);
                }
                break;

                case 5:         // manage
                    player.sendPacket(new NpcHtmlMessage(player, ai.fnManage, ObjID));
                    break;

                case 7:         //use buff
                {
                    int level = hideout.GetFuncLevel(AgitManagerAI.decotype_buff);
                    if (level == 0)
                    {
                        player.sendPacket(new NpcHtmlMessage(player, ai.fnFuncDisabled, ObjID));
                    }
                    else
                    {
                        NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnAgitBuff + "_" + level + ".htm", ObjID);
                        htm.replace("<?MPLeft?>", (int)CurMP);
                        player.sendPacket(htm);
                    }
                }
                break;

                case 12:         //use itemcreate
                {
                    int level = hideout.GetFuncLevel(AgitManagerAI.decotype_item);
                    if (level == 0)
                    {
                        player.sendPacket(new NpcHtmlMessage(player, ai.fnFuncDisabled, ObjID));
                    }
                    else
                    {
                        NpcData.getInstance().buylist(player, this, (short)level);
                    }
                }
                break;

                case 51:         // manage regen
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnManageRegen, ObjID);
                    htm.replace("<?HPDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_hpregen));
                    htm.replace("<?HPCost?>", hideout.GetCurrentDecoCost(AgitManagerAI.decotype_hpregen));
                    htm.replace("<?HPExpire?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    htm.replace("<?HPReset?>", "");

                    htm.replace("<?MPDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_mpregen));
                    htm.replace("<?MPCost?>", hideout.GetCurrentDecoCost(AgitManagerAI.decotype_mpregen));
                    htm.replace("<?MPExpire?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    htm.replace("<?MPReset?>", "");

                    htm.replace("<?XPDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_xprestore));
                    htm.replace("<?XPCost?>", hideout.GetCurrentDecoCost(AgitManagerAI.decotype_xprestore));
                    htm.replace("<?XPExpire?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    htm.replace("<?XPReset?>", "");
                    player.sendPacket(htm);
                }
                break;

                case 52:         // manage etc
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnManageEtc, ObjID);
                    htm.replace("<?TPDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_teleport));
                    htm.replace("<?TPCost?>", hideout.GetCurrentDecoCost(AgitManagerAI.decotype_teleport));
                    htm.replace("<?TPExpire?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    htm.replace("<?TPReset?>", "");

                    htm.replace("<?BFDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_buff));
                    htm.replace("<?BFCost?>", hideout.GetCurrentDecoCost(AgitManagerAI.decotype_buff));
                    htm.replace("<?BFExpire?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    htm.replace("<?BFReset?>", "");

                    htm.replace("<?ICDepth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_item));
                    htm.replace("<?ICCost?>", hideout.GetCurrentDecoCost(AgitManagerAI.decotype_item));
                    htm.replace("<?ICExpire?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    htm.replace("<?ICReset?>", "");
                    player.sendPacket(htm);
                }
                break;

                case 53:         // manage deco
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnManageDeco, ObjID);
                    htm.replace("<?7_Depth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_curtain));
                    htm.replace("<?7_Cost?>", hideout.GetCurrentDecoCost(AgitManagerAI.decotype_curtain));
                    htm.replace("<?7_Expire?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    htm.replace("<?7_Reset?>", "");

                    htm.replace("<?11_Depth?>", hideout.GetFuncDepth(AgitManagerAI.decotype_platform));
                    htm.replace("<?11_Cost?>", hideout.GetCurrentDecoCost(AgitManagerAI.decotype_platform));
                    htm.replace("<?11_Expire?>", hideout.PayTime.ToString("yyyy/MM/dd HH:mm"));
                    htm.replace("<?11_Reset?>", "");
                    player.sendPacket(htm);
                }
                break;
                }
                break;

            case -203:
                switch (reply)
                {
                case 1:         //open doors
                    foreach (L2Door door in hideout.doors)
                    {
                        if (door.Closed == 0)
                        {
                            continue;
                        }

                        door.Closed = 0;
                        door.broadcastUserInfo();
                    }

                    player.sendPacket(new NpcHtmlMessage(player, ai.fnAfterDoorOpen, ObjID));
                    break;

                case 2:         //close
                    foreach (L2Door door in hideout.doors)
                    {
                        if (door.Closed == 1)
                        {
                            continue;
                        }

                        door.Closed = 1;
                        door.broadcastUserInfo();
                    }

                    player.sendPacket(new NpcHtmlMessage(player, ai.fnAfterDoorClose, ObjID));
                    break;
                }
                break;

            case -208:     //buffs
                result = useBuff(reply, player);

                switch (result)
                {
                case 5:
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnNotEnoughMP, ObjID);
                    htm.replace("<?MPLeft?>", (int)CurMP);
                    player.sendPacket(htm);
                }
                break;

                case 1:
                case 4:
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnNeedCoolTime, ObjID);
                    htm.replace("<?MPLeft?>", (int)CurMP);
                    player.sendPacket(htm);
                }
                break;

                case -1:
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnAfterBuff, ObjID);
                    htm.replace("<?MPLeft?>", (int)CurMP);
                    player.sendPacket(htm);
                }
                break;
                }
                break;

            case -219:
                switch (reply)
                {
                case 1:         //banish action
                    hideout.Banish();
                    player.sendPacket(new NpcHtmlMessage(player, ai.fnAfterBanish, ObjID));
                    break;
                }
                break;

            case -270:
            {
                string val = reply + "";
                int    lvl = 0;
                int    id  = 0;
                if (val.Length == 5)
                {
                    id  = int.Parse(val.Remove(2));
                    lvl = int.Parse(val.Substring(3));
                }
                else
                {
                    lvl = int.Parse(val.Substring(2));
                    id  = int.Parse(val.Remove(1));
                }

                NpcHtmlMessage htm = new NpcHtmlMessage(player, "agitdeco__" + id + ".htm", ObjID);
                htm.replace("<?AgitDecoCost?>", hideout.GetDecoCost(id, lvl));
                htm.replace("<?AgitDecoEffect?>", hideout.GetDecoEffect(id, lvl));
                htm.replace("<?AgitDecoSubmit?>", reply);
                player.sendPacket(htm);
            }
            break;

            case -271:
            {
                result = 0;
                switch (reply)
                {
                case 1004:             //hp 80%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_hpregen, 4);
                    break;

                case 1006:             //hp 120%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_hpregen, 6);
                    break;

                case 1009:             //hp 180%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_hpregen, 9);
                    break;

                case 1012:             //hp 240%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_hpregen, 12);
                    break;

                case 1015:             //hp 300%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_hpregen, 15);
                    break;

                case 2001:            // mp 5%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_mpregen, 1);
                    break;

                case 2003:             //mp 15%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_mpregen, 3);
                    break;

                case 2006:             //mp 30%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_mpregen, 6);
                    break;

                case 2008:             //mp 40%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_mpregen, 8);
                    break;

                case 4003:            // xp 15%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_xprestore, 3);
                    break;

                case 4005:             //xp 25%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_xprestore, 5);
                    break;

                case 4007:             //xp 35%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_xprestore, 7);
                    break;

                case 4010:             //xp 50%
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_xprestore, 10);
                    break;

                case 5001:            // teleport lv 1
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_teleport, 1);
                    break;

                case 5002:             //teleport lv 2
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_teleport, 2);
                    break;

                case 7001:
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_curtain, 1);
                    break;

                case 7002:
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_curtain, 2);
                    break;

                case 9003:            // buff lv 3
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_buff, 3);
                    break;

                case 9005:             //buff lv 5
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_buff, 5);
                    break;

                case 9007:            // buff lv 7
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_buff, 7);
                    break;

                case 9008:             //buff lv 8
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_buff, 8);
                    break;

                case 11001:            // deco 11 lv 1
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_platform, 1);
                    break;

                case 11002:             //deco 11 lv 2
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_platform, 2);
                    break;

                case 12001:            // itemcreate lv 1
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_item, 1);
                    break;

                case 12002:             //itemcreate lv 2
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_item, 2);
                    break;

                case 12003:            // itemcreate lv 3
                    result = hideout.MofidyFunc(AgitManagerAI.decotype_item, 3);
                    break;
                }

                switch (result)
                {
                case 1:
                {
                    NpcHtmlMessage htm = new NpcHtmlMessage(player, ai.fnDecoAlreadySet, ObjID);
                    htm.replace("<?AgitDecoEffect?>", "Decoration");                 //TODO name
                    player.sendPacket(htm);
                }
                break;

                case 2:
                    player.sendPacket(new NpcHtmlMessage(player, ai.fnFailtoSetDeco, ObjID));
                    break;

                case 5:
                    player.sendPacket(new NpcHtmlMessage(player, ai.fnAfterSetDeco, ObjID));
                    broadcastHideoutUpdate(player);
                    break;
                }
            }
            break;
            }
        }