public virtual void TryAccept(L2Player player, L2Npc npc) { }
public virtual void UsePlayer(L2Player player, L2Item item) { player.SendMessage("You cannot use this item."); }
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(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(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); }); }
public override void OnForcedAttack(L2Player player) { player.SendActionFailed(); }
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); }
public void EnterWorld(L2Player p) { p.NotifyDayChange(Night ? _nightPk : _dayPk); }
public void NotifyStats(L2Player owner) { }
public override void run() { L2Player player = Client.CurrentPlayer; if (player.EnchantState != ItemEnchantManager.STATE_ENCHANT_START) { player.sendSystemMessage(355);//Inappropriate enchant conditions. player.sendActionFailed(); return; } if (a_sTargetID != player.EnchantItem.ObjID) { player.sendSystemMessage(355);//Inappropriate enchant conditions. player.sendActionFailed(); return; } short rate = 50; if (player.EnchantStone != null) { EnchantScroll stone = ItemEnchantManager.getInstance().getSupport(player.EnchantStone.Template.ItemID); rate += stone.bonus; } if (player.EnchantItem.Enchant < 4) { rate = 100; } if (rate > 100) { rate = 100; } InventoryUpdate iu = null; bool equip = false; if (rate == 100 ? true : new Random().Next(100) < rate) { player.EnchantItem.Enchant += 1; player.EnchantItem.sql_update(); iu = new InventoryUpdate(); iu.addModItem(player.EnchantItem); player.sendPacket(new EnchantResult(EnchantResultVal.success)); equip = player.EnchantItem._isEquipped == 1; if (equip && player.EnchantItem.Enchant == 4 && player.EnchantItem.Template.item_skill_ench4 != null) { player.addSkill(player.EnchantItem.Template.item_skill_ench4, false, false); player.updateSkillList(); } //todo check +6 set } else { EnchantScroll scr = ItemEnchantManager.getInstance().getScroll(player.EnchantScroll.Template.ItemID); switch (scr.Type) { case EnchantType.blessed: player.EnchantItem.Enchant = 0; player.EnchantItem.sql_update(); iu = new InventoryUpdate(); iu.addModItem(player.EnchantItem); player.sendPacket(new EnchantResult(EnchantResultVal.breakToOne)); break; case EnchantType.ancient: player.sendPacket(new EnchantResult(EnchantResultVal.safeBreak)); break; default: { if (player.EnchantItem._isEquipped == 1) { int pdollId = player.Inventory.getPaperdollId(player.EnchantItem.Template); player.setPaperdoll(pdollId, null, false); equip = true; } player.Inventory.removeItem(player.EnchantItem); iu = new InventoryUpdate(); iu.addDelItem(player.EnchantItem); long cry = player.EnchantItem.Template._cryCount; if (cry == 0) { player.sendPacket(new EnchantResult(EnchantResultVal.breakToNothing)); } else { int id = player.EnchantItem.Template.getCrystallId(); player.sendPacket(new EnchantResult(EnchantResultVal.breakToCount, id, cry)); player.Inventory.addItem(id, cry, true, true); } } break; } } if (player.EnchantStone != null) { player.Inventory.destroyItem(player.EnchantStone, 1, true, true); } player.Inventory.destroyItem(player.EnchantScroll, 1, false, true); if (iu != null) { player.sendPacket(iu); } player.EnchantItem = null; player.EnchantScroll = null; player.EnchantStone = null; player.EnchantState = 0; if (equip) { player.broadcastUserInfo(); } }
public override async Task NotifyActionAsync(L2Player player) { double dis = Calcs.CalculateDistance(player, this, true); await Movement.MoveTo(X, Y, Z); }
protected internal override void use(L2Player admin, string alias) { //snoop [charname | .] [ON | OFF] -- включить слежение за сообщениями персонажа }
public override void RunImpl() { L2Player player = _client.CurrentPlayer; player.SendPacket(new ObservationReturn(player.Obsx, player.Obsy, player.Obsz)); }
public virtual void OnEarnItem(L2Player player, int stage, int id) { }
public virtual void OnTalkToNpcQm(L2Player player, L2Npc npc, int reply) { }
public virtual bool CanTalk(L2Player player, L2Npc npc) { return(TalkNpcs.Any(id => npc.Template.NpcId == id)); }
public CharacterSelected(L2Player player, int session) { _player = player; _session = session; }
public override void OnDialog(L2Player player, int ask, int reply) { player.FolkNpc = this; //if (ask > 0 && ask < 1000) //{ // QuestManager.Instance.OnQuestTalk(player, this, ask, reply); // return; //} //AITemplate t = AIManager.Instance.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.Instance.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.Instance.RequestTeleportList(this, player, 2); // break; // } // break; // case -21: //нобл запрос // switch (reply) // { // case 2: // NpcData.Instance.RequestTeleportList(this, player, 3); // break; // } // break; // case -22: //нобл запрос // switch (reply) // { // case 2: // NpcData.Instance.RequestTeleportList(this, player, 1); // break; // } // break; // case -303: // MultiSell.Instance.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; //} }
public WareHouseDepositList(L2Player player, List <L2Item> items, short type) { _type = type; _adena = player.GetAdena(); _items = items; }
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; } }
public L2Player LoadPlayerInSlot(string accName, int charSlot) { L2Player player = PlayerService.GetPlayerBySlotId(accName, charSlot); return(player); }
public static void CreateClan(L2Player player, string name, L2Npc npc) { }
private void TryEquipSecondary(L2Player owner) { }
public override void RunImpl() { L2Player player = _client.CurrentPlayer; L2Item item = player.Inventory.GetItemByItemId(_itemId); }
public override void RunImpl() { L2Player player = _client.CurrentPlayer; }
public override void run() { L2Player player = Client.CurrentPlayer; player.sendItemList(true); }
public override async Task RunImpl() { await Task.Run(() => { L2Player player = _client.CurrentPlayer; if (player.PBlockAct == 1) { player.SendActionFailedAsync(); return; } L2Npc npc; L2Warehouse warehouseNPC; if (_alias.EqualsIgnoreCase("teleport_request")) { npc = GetNpc(); if (npc == null) { player.SendActionFailedAsync(); return; } npc.OnTeleportRequest(player); } else { if (_alias.StartsWithIgnoreCase("menu_select?")) { npc = GetNpc(); _alias = _alias.Replace(" ", string.Empty); string x1 = _alias.Split('?')[1]; string[] x2 = x1.Split('&'); int ask = int.Parse(x2[0].Substring(4)); int reply; try { reply = int.Parse(x2[1].Substring(6)); } catch { reply = 0; } npc.OnDialog(player, ask, reply); } else { if (_alias.EqualsIgnoreCase("talk_select")) { npc = GetNpc(); //QuestManager.Instance.TalkSelection(player, npc); } else { if (_alias.StartsWithIgnoreCase("quest_accept?")) { npc = GetNpc(); _alias = _alias.Replace(" ", string.Empty); string x1 = _alias.Split('?')[1]; int qid = int.Parse(x1.Split('=')[1]); //QuestManager.Instance.QuestAccept(player, npc, qid); } else { if (_alias.StartsWithIgnoreCase("quest_continue?")) { npc = GetNpc(); _alias = _alias.Replace(" ", string.Empty); string x1 = _alias.Split('?')[1]; int qid = int.Parse(x1.Split('=')[1]); //QuestManager.Instance.Quest_continue(player, npc, qid); } else { if (_alias.StartsWithIgnoreCase("quest_tryaccept?")) { npc = GetNpc(); _alias = _alias.Replace(" ", string.Empty); string x1 = _alias.Split('?')[1]; int qid = int.Parse(x1.Split('=')[1]); // QuestManager.Instance.Quest_tryaccept(player, npc, qid); } else { if (_alias.Contains("DepositP")) { warehouseNPC = GetWarehouseNPC(); warehouseNPC.ShowPrivateWarehouse(player); return; } else { if (_alias.Contains("WithdrawP")) { warehouseNPC = GetWarehouseNPC(); warehouseNPC.ShowPrivateWarehouseBack(player); return; } else { if (_alias.Contains("DepositC")) { warehouseNPC = GetWarehouseNPC(); warehouseNPC.ShowClanWarehouse(player); return; } else { if (_alias.Contains("WithdrawC")) { warehouseNPC = GetWarehouseNPC(); warehouseNPC.ShowClanWarehouseBack(player); return; } else { if (_alias.EqualsIgnoreCase("learn_skill")) { npc = GetNpc(); npc.ShowSkillLearnAsync(player, false); } else { if (_alias.StartsWithIgnoreCase("create_pledge?")) { npc = GetNpc(); //bypass -h create_pledge?pledge_name= $pledge_name string x1 = _alias.Split('?')[1]; string name = x1.Split('=')[1]; name = name.Substring(1); // GrandmasterTotal.CreateClan(player, name, npc); } else { if (_alias.StartsWithIgnoreCase("teleport_next?")) { npc = GetNpc(); string x1 = _alias.Split('?')[1]; string[] x2 = x1.Split('&'); int ask = int.Parse(x2[0].Substring(4)); int reply = int.Parse(x2[1].Substring(6)); npc.UseTeleporter(player, ask, reply); } else { if (_alias.StartsWithIgnoreCase("npc")) { npc = GetNpc(); Log.Warn($"Bypass Accepted '{_alias}'"); } else { if (_alias.StartsWithIgnoreCase("petitionlink?")) { PetitionManager.GetInstance().Petitionlink(player, _alias.Split('?')[1]); } else { Log.Warn($"Unknown bypass '{_alias}'"); } } } } } } } } } } } } } } } }); }
protected internal override void Use(L2Player admin, string alias) { }
public override void OnAction(L2Player player) { player.SendMessage(AsString()); player.SetTarget(this); }
public override void run() { L2Player player = Client.CurrentPlayer; if (player.TradeState < 3)// умник { player.sendActionFailed(); return; } if (player.EnchantState != 0) { player.sendActionFailed(); return; } if (player.requester == null) { player.sendMessage("Your trade requestor has logged off."); player.sendActionFailed(); player.TradeState = 0; return; } if (player.TradeState == 4 || player.requester.TradeState == 4) // подтвердил уже { player.sendSystemMessage(122); //You may no longer adjust items in the trade because the trade has been confirmed. player.sendActionFailed(); return; } L2Item item = player.Inventory.getByObject(sID); if (item == null) { player.sendActionFailed(); return; } if (num < 0) { num = 1; } if (num > item.Count) { num = item.Count; } if (!item.Template.isStackable() && num > 1) { num = 1; } long numInList = player.AddItemToTrade(item.ObjID, num); long numCurrent = item.Count - numInList; player.sendPacket(new TradeOwnAdd(item, numInList)); player.requester.sendPacket(new TradeOtherAdd(item, numInList)); byte action = 2; //mod, 2-del if (item.Template.isStackable()) { action = 3; if (numCurrent < 1) { action = 2; } } player.sendPacket(new TradeUpdate(item, numCurrent, action)); }
public override void RunImpl() { L2Player player = _client.CurrentPlayer; player.BroadcastPacket(new StartRotation(player.ObjId, _degree, _side, 0)); }
public virtual void OnKill(L2Player player, L2Warrior mob, int stage) { }