示例#1
0
        public void UseLotteryItem(short nPOS, int nItemID)
        {
            if (Parent.Stats.nHP <= 0)
            {
                return;
            }

            var pItemRaw = InventoryManipulator.GetItem(Parent, ItemConstants.GetInventoryType(nItemID), nPOS);             // TODO determine if we can hardcode the inventory type

            var itemResult = MasterManager.CreateItem(RandomBoxes.GetRandom(nItemID));

            if (itemResult != null && pItemRaw is GW_ItemSlotBundle pItem)
            {
                if (InventoryManipulator.CountFreeSlots(Parent, InventoryType.Equip) > 0 && InventoryManipulator.CountFreeSlots(Parent, InventoryType.Consume) > 0)
                {
                    InventoryManipulator.RemoveFrom(Parent, pItemRaw.InvType, nPOS);
                    InventoryManipulator.InsertInto(Parent, itemResult);
                }
                else
                {
                    Parent.SendMessage("Please make some room in your inventory.");
                }
            }
            else
            {
                Parent.SendMessage("This item has not been implemented yet. If you believe this to be an error, please report it on the discord server.");
            }
        }
示例#2
0
	public void init (BlacksmithScreen blacksmithScreen) {
		this.blacksmithScreen = blacksmithScreen;
		backBtn = transform.Find("BackBtn").GetComponent<Button>();
		inventoryManipulator = GetComponent<InventoryManipulator>();
		inventoryManipulator.init(new List<EquipmentHolder>());
		gameObject.SetActive(false);
	}
示例#3
0
        public void HandleConfirmTrade(Character confirmer)
        {
            if (!acceptedInvite || confirmer.dwId == dwFirstLockerId)
            {
                return; // PE
            }
            if (IsOwner(confirmer))
            {
                Partner.SendPacket(PartnerLockPacket());
            }
            else
            {
                Parent.SendPacket(PartnerLockPacket());
            }

            if (dwFirstLockerId > 0)
            {
                if (InventoryManipulator.HasSpace(Parent, tempInvPartner) && InventoryManipulator.HasSpace(Parent, tempInvOwner))
                {
                    CurrentStatus = MR_LeaveResult.TradeDone;
                }
                else
                {
                    CurrentStatus = MR_LeaveResult.TradeFail;
                }
                Destroy();
            }
            else
            {
                dwFirstLockerId = confirmer.dwId;
            }
        }
示例#4
0
        /// <summary>
        /// Move an item from the character's account cash locker to the character's storage.
        /// </summary>
        /// <param name="c"></param>
        /// <param name="p"></param>
        public static void MoveLToS(WvsShopClient c, CInPacket p)
        {
            if (p.Available < 8)
            {
                return;
            }

            var sn = p.Decode8();

            var cashItem = c.CashLocker.GetBySN(sn);

            // unable to find item
            if (cashItem == null)
            {
                return;
            }

            var nTargetSlot = InventoryManipulator.InsertInto(c.Character, cashItem.Item);

            // item insertion failed
            if (nTargetSlot == 0)
            {
                return;                               // TODO proper error code/response
            }
            c.CashLocker.Remove(cashItem);

            c.SendPacket(CPacket.CCashShop.MoveLtoSResponse(cashItem, nTargetSlot));
        }
        public bool AddRandomMasteryBook(int nJobID = -1)
        {
            int bookid;

            if (nJobID == -1)
            {
                bookid = MasterManager.ItemTemplates
                         .MasteryBooks()
                         .Random()                // grab random set
                         .Random();               // grab random item from set
            }
            else
            {
                bookid = MasterManager.ItemTemplates
                         .MasteryBooksByJob(PlayerJob)
                         .Random();
            }

            if (bookid <= 0)
            {
                return(false);
            }

            var item = MasterManager.CreateItem(bookid);

            var slot = InventoryManipulator.InsertInto(Character, item);

            return(slot != 0);
        }
        public bool ActivateSinglePet(short nPos, bool bForce = false)
        {
            if (Pets[0] != null && !bForce)
            {
                DeactivateSinglePet();

                return(true);
            }

            if (Parent.Field.Template.HasNoPetLimit())
            {
                Parent.SendMessage("Pets are not allowed in this map");
                return(false);
            }

            var pItemRaw = InventoryManipulator.GetItem(Parent, InventoryType.Cash, nPos);

            if (pItemRaw is GW_ItemSlotPet pet)
            {
                if (pet.PetTemplate.EvolNo > 0)
                {
                    Parent.SendMessage("Evolving have not been coded yet, sorry :(");
                    return(false);
                }

                ActivatePet(pet, nPos, 0);

                return(true);
            }

            return(false);
        }
示例#7
0
        public static void Attempt(Character c)
        {
            if (Constants.Rand.NextDouble() > Constants.MobDeathRoulette_Odds)
            {
                return;
            }

            var roulette = new MobDeathRoulette();

            for (int i = -1; i < 3; i++)
            {
                var effect = new FieldEffectPacket(FieldEffect.Screen)
                {
                    sName = roulette.GetEffectString(i)
                };

                effect.Broadcast(c, true);
            }

            var pItem = MasterManager.CreateItem(roulette.nScrollItemID);

            pItem.nNumber = 1;

            // todo delay this
            InventoryManipulator.InsertInto(c, pItem);
        }
	public void init () {
		Transform equipments = transform.Find("EquipmentHolders");
		equipments.gameObject.SetActive(true);
		EquipmentHolder holder;
		for (int i = 0; i < equipments.childCount; i++) {
			holder = equipments.GetChild(i).GetComponent<EquipmentHolder>();
			holder.init(this);
			equipmentHolders.Add(holder);
		}
		potionBag = Vars.gameplay.getPotionBag();
		foreach (PotionHolder pHolder in potionBag.getPotionHolders()) {
			equipmentHolders.Add(pHolder);
		}

		inventoryManipulator = GetComponent<InventoryManipulator>();
		inventoryManipulator.init(equipmentHolders);

		Transform attributes = transform.Find("Attributes");
		damageValue = attributes.Find("DamageValue").GetComponent<StrokeText>();
		armorValue = attributes.Find("ArmorValue").GetComponent<StrokeText>();
		strengthValue = attributes.Find("StrengthValue").GetComponent<StrokeText>();
		enduranceValue = attributes.Find("EnduranceValue").GetComponent<StrokeText>();
		agilityValue = attributes.Find("AgilityValue").GetComponent<StrokeText>();
		luckValue = attributes.Find("LuckValue").GetComponent<StrokeText>();
		setLayersForText(attributes);
		addAttributes = attributes.Find("AddAttributes").GetComponent<AddAttributes>();
		addAttributes.init();
		transform.Find("BG").gameObject.SetActive(true);
		attributes.gameObject.SetActive(true);
		gameObject.SetActive(false);
	}
示例#9
0
        private static void SellItem(Character pChar, short nSlot, int nItemId, short nCount)
        {
            var pItem = InventoryManipulator.GetItem(pChar, ItemConstants.GetInventoryType(nItemId), nSlot);

            if (pItem is null)
            {
                pChar.SendMessage("Trying to sell null item.");
                pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.SellIncorrectRequest));
                return;
            }

            if (pItem.CashItem || pItem.NotSale)
            {
                pChar.SendMessage("Cannot trade cash items.");
                return;
            }

            var nCostPerItem = pItem.Template.Price;

            nCount = ItemConstants.is_treat_singly(nItemId) ? (short)1 : nCount;

            var nFinalCost = nCostPerItem * nCount;

            if (pItem.IsRechargeable)
            {
                var dUnitPrice = ((ConsumeItemTemplate)pItem.Template).UnitPrice;

                nFinalCost += (int)Math.Floor(dUnitPrice * pItem.nNumber);
            }

            if (pItem is GW_ItemSlotBundle && !pItem.IsRechargeable)
            {
                if (pItem.nNumber < nCount)
                {
                    pChar.SendMessage("Trying to sell more than you possess.");
                    pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.SellIncorrectRequest));
                    return;
                }

                if (nCount <= 0)
                {
                    pChar.SendMessage("Trying to sell negative amount.");
                    pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.SellIncorrectRequest));
                    return;
                }
            }
            else
            {
                nCount = -1;
            }

            pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.SellSuccess));

            //pChar.SendMessage("final price: " + nFinalCost);

            InventoryManipulator.RemoveFrom(pChar, pItem.InvType, nSlot, nCount);
            pChar.Modify.GainMeso(nFinalCost, false);
        }
示例#10
0
        private static void RechargeItem(Character pChar, short nSlot)
        {
            var pItem = InventoryManipulator.GetItem(pChar, InventoryType.Consume, nSlot);

            if (pItem is null)
            {
                pChar.SendMessage("Trying to recharge null item.");
                pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.RechargeIncorrectRequest));
                return;
            }

            if (!ItemConstants.IsRechargeableItem(pItem.nItemID))
            {
                pChar.SendMessage("Trying to recharge item that isn't rechargeable.");
                pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.RechargeIncorrectRequest));
                return;
            }

            var slotmax = pItem.SlotMax;

            if (pChar.Skills.Get(false,
                                 (int)Skills.NIGHTWALKER_JAVELIN_MASTERY,
                                 (int)Skills.ASSASSIN_JAVELIN_MASTERY) is SkillEntry se)
            {
                slotmax += (short)se.Y_Effect;
            }

            if (pItem.nNumber >= slotmax)
            {
                pChar.SendMessage("Trying to recharge item that is fully charged.");
                pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.RechargeIncorrectRequest));
                return;
            }

            var dUnitPrice = (pItem.Template as ConsumeItemTemplate).UnitPrice;

            var nRechargeNeeded     = slotmax - pItem.nNumber;
            var nTotalRechargePrice = (int)Math.Floor(nRechargeNeeded * dUnitPrice);

            if (pChar.Stats.nMoney < nTotalRechargePrice)
            {
                pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.RechargeNoMoney));
                return;
            }

            pChar.Modify.GainMeso(-nTotalRechargePrice);

            pItem.nNumber = slotmax;

            pChar.Modify.Inventory(ctx =>
            {
                ctx.UpdateQuantity(InventoryType.Consume, nSlot, pItem.nNumber);
            });

            pChar.SendPacket(CPacket.CShopDlg.ShopResult(ShopRes.RechargeSuccess));
        }
示例#11
0
        private static void HandleDisassembleOp(Character pChar, InventoryType nInvType, int nItemID, int nSlotPos)
        {
            var pItem = InventoryManipulator.GetItem(pChar, nInvType, (short)nSlotPos);

            if (pItem is GW_ItemSlotEquip pItemEquip)
            {
                var nCost = pItemEquip.Template.Price * 0.1363;
            }
            else
            {
            }
        }
        public void OnLostQuestItem(CInPacket p, short nQuestID)
        {
            var nLostCount = p.Decode4();

            var pAct = MasterManager.QuestTemplates[nQuestID].StartAct;

            if (pAct is null)
            {
                return;                           // invalid quest ID
            }
            if (nLostCount <= 0 || pAct.Items.Length <= 0)
            {
                return;                                                        // TODO trigger AB, close socket
            }
            var aLostItem = p.DecodeIntArray(nLostCount);

            foreach (var item in pAct.Items)
            {
                if (!aLostItem.Contains(item.Item.ItemID))
                {
                    continue;                                                        // TODO trigger AB?
                }
                if (ItemConstants.GetInventoryType(item.Item.ItemID) == InventoryType.Equip)
                {
                    Parent.SendMessage("Not currently supported. Check again later.");
                    return;                     // TODO
                }

                if (!MasterManager.ItemTemplates[item.Item.ItemID]?.Quest ?? true)
                {
                    continue;
                }

                if (InventoryManipulator.HasSpace(Parent, item.Item.ItemID, (short)item.Item.Count))
                {
                    var itemToAdd = MasterManager.CreateItem(item.Item.ItemID);
                    itemToAdd.nNumber = (short)item.Item.Count;
                    InventoryManipulator.InsertInto(Parent, itemToAdd);
                }
                else
                {
                    // TODO proper response packet
                    Parent.SendMessage("Please make space in your inventory.");
                    return;
                }
            }

            // TODO
            // if ( aChangedItem.a && *(aChangedItem.a - 1) > 0u )
            //		CUser::PostQuestEffect(&v16->vfptr, 1, &aChangedItem, 0, 0);
        }
示例#13
0
        /**
         * Client sends cash item SN.
         * We index cash items by their serial number.
         * WZ files indexes cash items by a commodity ID.
         * The commodity ID (~12000 total) is not used for anything.
         */
        public static void Buy(WvsShopClient c, CInPacket p)
        {
            // validate packet length
            if (p.Available < 9)
            {
                return;
            }

            p.Decode1();             // 00
            var cashType     = (CashType)p.Decode4();
            var nCommoditySN = p.Decode4();

            var commodityInfo = MasterManager.CommodityProvider[nCommoditySN];

            if (commodityInfo == null)
            {
                return;
            }
            if (!commodityInfo.OnSale)
            {
                return;                                    // TODO proper error code/response
            }
            var item = MasterManager.CreateCashCommodityItem(nCommoditySN);

            if (item is null)
            {
                return;
            }

            if (!c.Account.HasCash(cashType, item.NXCost))
            {
                return;                                                        // TODO proper error code/response
            }
            if (ItemConstants.IsPet(item.nItemID) &&
                InventoryManipulator.GetItemByCashSN(c.Character, InventoryType.Cash, item.SN).Item2 != null)
            {
                return;                 // cant have two of the same pet cuz it screws up our indexing
            }
            c.CashLocker.Add(item);
#if DEBUG
            c.Account.ModifyCash(cashType, 10000);
            Log.Info($"{commodityInfo.CashItemSN}");
#else
            c.Account.ModifyCash(cashType, -commodityInfo.Price);
#endif
            item.dwAccountID   = c.Account.ID;
            item.dwCharacterID = c.dwCharId;

            c.SendPacket(CPacket.CCashShop.BuyResponse(item));
            // do best items/limited goods handling here
        }
        public void AddItem(int itemId, short amount = 1)
        {
            var item = MasterManager.CreateItem(itemId);

            if (item is GW_ItemSlotBundle isb)
            {
                if (item.IsRechargeable == false)
                {
                    isb.nNumber = Math.Max((short)1, amount);
                }
            }

            InventoryManipulator.InsertInto(Character, item);

            Character.SendPacket(CPacket.DropPickUpMessage_Item(itemId, amount, true));
        }
示例#15
0
        public void EncodeEquippedRings(COutPacket p)
        {
            #region COUPLE_RING

            p.Encode1(0);             // TODO

            #endregion

            #region FRIENDSHIP_RING

            GW_FriendRecord pFriendshipRing   = null;
            var             nFriendshipRingID = 0;
            long            nFriendShipSN     = 0;

            for (var bp = BodyPart.BP_RING1; bp < BodyPart.BP_RING4; bp++)
            {
                var item = InventoryManipulator.GetItem(Parent, bp, true);

                if (item is null)
                {
                    continue;
                }

                if (ItemConstants.is_friendship_equip_item(item.nItemID))
                {
                    pFriendshipRing = lFriendRecord.FirstOrDefault(ring => ring.liSN == item.liSN);
                    break;
                }
            }

            p.Encode1(pFriendshipRing != null);

            if (pFriendshipRing != null)
            {
                p.Encode8(pFriendshipRing.liSN);
                p.Encode8(pFriendshipRing.liPairSN);
                p.Encode4(pFriendshipRing.dwFriendItemID);
            }

            #endregion

            #region MARRIAGE_RING

            p.Encode1(0);             // TODO

            #endregion
        }
示例#16
0
        private void Handle_CashShopCheckCouponRequest(WvsShopClient c, CInPacket p)
        {
            p.Decode2();             // something

            var code = p.DecodeString();

            var coupon = new CouponCode(code, c);

            if (coupon.Invalid)
            {
                c.SendPacket(CPacket.CCashShop.CouponFail(CashItemFailed.InvalidCoupon));
            }
            else if (coupon.Used)
            {
                c.SendPacket(CPacket.CCashShop.CouponFail(CashItemFailed.UsedCoupon));
            }
            else if (coupon.IncorrectAccount)
            {
                c.SendPacket(CPacket.CCashShop.CouponFail(CashItemFailed.NotAvailableCoupon));
            }
            else if (coupon.Expired)
            {
                c.SendPacket(CPacket.CCashShop.CouponFail(CashItemFailed.ExpiredCoupon));
            }
            else if (coupon.Items != null && !InventoryManipulator.HasSpace(c.Character, coupon.Items))
            {
                c.SendPacket(CPacket.CCashShop.CouponFail(CashItemFailed.NoEmptyPos));                 // TODO fix this
            }
            else
            {
                if (coupon.Items != null)
                {
                    foreach (var item in coupon.Items)
                    {
                        InventoryManipulator.InsertInto(c.Character, MasterManager.CreateItem(item, false));
                        CPacket.CCashShop.CouponAddItem(item);
                    }
                }

                c.Account.AccountData.NX_Prepaid += coupon.NX;
                coupon.Dispose();
                c.Account.Save();
            }

            c.EnableActions();
        }
示例#17
0
        public void HandleAddItem(CInPacket p, Character pChar)
        {
            if (dwFirstLockerId == pChar.dwId || !acceptedInvite)
            {
                return;
            }

            var nTI         = (InventoryType)p.Decode1();
            var nCurInvSlot = p.Decode2(); // in inventory
            var nCount      = p.Decode2();
            var nTargetSlot = p.Decode1(); // in trade window

            var pItem = InventoryManipulator.GetItem(pChar, nTI, nCurInvSlot);

            var tempInv = GetTempInv(pChar);

            if (pItem is null || !tempInv.CanAddToSlot(nTargetSlot))
            {
                return;
            }

            if (ItemConstants.is_treat_singly(pItem.nItemID))
            {
                nCount = -1; // negative amount clears the slot
            }
            else
            {
                nCount = Math.Min(pItem.nNumber, Math.Abs(nCount));
            }

            InventoryManipulator.RemoveFrom(pChar, nTI, nCurInvSlot, nCount);

            if (pItem is GW_ItemSlotBundle pBundle && !pBundle.IsRechargeable)
            {
                pItem         = pItem.DeepCopy();
                pItem.nNumber = nCount;
            }

            var pTempItem = new TempItem(pItem, nCurInvSlot, nTargetSlot);

            tempInv.Add(pTempItem);

            Parent.SendPacket(AddItemPacket(pTempItem, !IsOwner(pChar)));
            Partner.SendPacket(AddItemPacket(pTempItem, IsOwner(pChar)));
        }
示例#18
0
        /// <summary>
        /// Return values:
        /// 0: Success
        /// 1: Internal failure
        /// 2: Unable to find item id in inventory
        /// </summary>
        public int MakeRandAvatar(int nItemID, int[] anCanadite)
        {
            if (anCanadite.Length <= 0)
            {
                return(1);                                    // invalid input
            }
            var itemslot = Character.InventoryCash.FindItemSlot(nItemID);

            if (itemslot <= 0)
            {
                return(2);                           // unable to find item
            }
            var retIndex = 0;

            if (retIndex > anCanadite.Length)
            {
                return(1);                                          // invalid selection
            }
            // TODO consider validating item template existence

            Character.Modify.Stats(ctx =>
            {
                var selectionItem = anCanadite.Random();
                if (selectionItem / 10000 == 2)
                {
                    ctx.Face = selectionItem;
                    retIndex = 0;
                }
                else if (selectionItem / 10000 == 3)
                {
                    ctx.Hair = selectionItem;
                    retIndex = 0;
                }
                else
                {
                    retIndex = 1;                     // invalid item ID
                }
            });

            InventoryManipulator.RemoveFrom(Character, InventoryType.Cash, itemslot, 1);

            return(0);
        }
示例#19
0
        /// <summary>
        /// Transfer items from a temp inventory to a character inventory.
        /// No validation is done to see if the items will fit.
        /// At the end of this method the temp inventory is cleared.
        /// </summary>
        /// <param name="pChar">Character to transfer items to.</param>
        /// <param name="pTempInv">Inventory to transfer items from.</param>
        /// <param name="bSubtractFee">If the money being transferred should have the trade fee deducted.</param>
        private void TransferItems(Character pChar, TempInventory pTempInv, bool bSubtractFee)
        {
            foreach (var item in pTempInv.GetAll())
            {
                InventoryManipulator.InsertInto(pChar, item.Item);
            }

            if (pTempInv.Meso > 0)
            {
                if (bSubtractFee)
                {
                    pTempInv.Meso -= Fee((int)pTempInv.Meso);
                }

                pChar?.Modify.GainMeso((int)pTempInv.Meso);
            }

            pTempInv.Clear();
        }
示例#20
0
        // use this when we implement mulit-pet
        public bool ActivatePet(short nPos, bool bLeader)
        {
            throw new InvalidOperationException("Multipet not active");
            var pItemRaw = InventoryManipulator.GetItem(Parent, InventoryType.Cash, nPos);

            if (pItemRaw is GW_ItemSlotPet cPetItem)
            {
                if (cPetItem.PetTemplate.EvolNo > 0)
                {
                    Parent.SendMessage("Evolving pets are not currently handled. Please try again later.");
                    return(false);
                }

                if (DeactivatePet(cPetItem.liCashItemSN))
                {
                    return(true);
                }

                byte nIdx = 0xFF;

                for (byte i = 0; i < 3; i++)
                {
                    if (Pets[i] == null)
                    {
                        nIdx = i;
                        break;
                    }
                }

                if (nIdx == 0xFF)
                {
                    return(false);
                }

                ActivatePet(cPetItem, nPos, nIdx);
                Parent.Modify.UpdatePetLocker();

                return(true);
            }

            return(false);
        }
示例#21
0
        /// <summary>
        /// Handles HP/MP/EXP reduction on death.
        /// Cancels all buffs.
        /// Warps player to return map.
        /// </summary>
        /// <param name="user"></param>
        public virtual void OnUserWarpDie(Character user, bool bLoseExp = true)
        {
            user.StatisticsTracker.nDeaths += 1;
            if (nFieldDeathCount > 0)
            {
                UpdateDeathCount(--nFieldDeathCount);
            }

            if (Template.HasNoExpDecrease() || !bLoseExp)
            {
                user.Modify.Stats(ctx =>
                {
                    ctx.HP = user.BasicStats.nMHP;
                    ctx.MP = user.BasicStats.nMMP;
                });
            }
            else
            {
                const int nCharmId = 5130000;

                if (InventoryManipulator.RemoveQuantity(user, nCharmId, 1))
                {
                    // TODO use real notification packet for this
                    user.SendMessage($"A safety charm has been used to avoid losing exp!");
                    user.Modify.Heal((int)(user.BasicStats.nMHP * 0.33), (int)(user.BasicStats.nMMP * 0.33));
                }
                else
                {
                    user.Modify.Stats(ctx =>
                    {
                        ctx.decrease_exp(user.Field.Template.Town || user.Field.Mobs.aMobGen.Count == 0);
                        ctx.HP = 1;
                        ctx.MP = 1;
                    });
                }
            }

            user.Buffs.CancelAllBuffs();

            user.Action.SetField(user.Field.ReturnMapId);
        }
示例#22
0
        public void EncodeMultiPetInfo(COutPacket p)         // this is just used for the CharacterInfo packet
        {
            for (byte i = 0; i < 3; i++)
            {
                if (Pets[i] != null)
                {
                    p.Encode1(1);

                    var cp = Pets[i];
                    p.Encode4(cp.dwTemplateID);
                    p.EncodeString(cp.sName);
                    p.Encode1(cp.Level);
                    p.Encode2(cp.Tameness);
                    p.Encode1(cp.Repleteness);                                                            //i think
                    p.Encode2(cp.Skill);
                    p.Encode4(InventoryManipulator.GetItem(Parent, petwearparts[i], true)?.nItemID ?? 0); // TODO verify
                }
            }

            p.Encode1(0);
        }
示例#23
0
        /// <summary>
        /// Teleport scroll handling.
        /// </summary>
        /// <param name="nPOS"></param>
        /// <param name="nItemID"></param>
        public void UsePortalScroll(int nItemID, short nPOS)
        {
            if (Parent.Stats.nHP <= 0)
            {
                return;
            }

            if (Parent.Field.Template.HasPortalScrollLimit())
            {
                return;
            }

            if (InventoryManipulator.GetItem(Parent, InventoryType.Consume, nPOS)?.Template is ConsumeItemTemplate template)
            {
                if (template.MoveTo > 0)
                {
                    Parent.Action.SetField(template.MoveTo == 999999999 ? Parent.Field.ReturnMapId : template.MoveTo);
                }
            }

            InventoryManipulator.RemoveFrom(Parent, InventoryType.Consume, nPOS);
        }
示例#24
0
        /// <summary>
        /// Performs consume on pickup logic and inserts item into inventory
        ///		if it fits. Will return false if item does not fit.
        /// Some field child classes change drop pickup behavior.
        /// If returns true, the drop pool will remove the drop and display
        ///		proper drop pickup messages, else calling function will return.
        /// </summary>
        /// <param name="pUser">Character picking up the item</param>
        /// <param name="pDrop">Item being picked up</param>
        public virtual bool TryDropPickup(Character pUser, CDrop pDrop)
        {
            if (pDrop.Item.Template is ConsumeItemTemplate template)
            {
                if (template.MonsterBook)
                {
                    pUser.MonsterBook.AddCard(pDrop.ItemId);
                    pUser.SendMessage("You have found a monster book card!");
                    pUser.Modify.GainNX(1000);

                    return(false);
                }

                if (template.ConsumeOnPickup)
                {
                    pUser.Buffs.AddItemBuff(template.TemplateId);
                    return(false);
                }
            }

            return(InventoryManipulator.InsertInto(pUser, pDrop.Item) > 0);
        }
示例#25
0
        public override void Execute(CommandCtx ctx)
        {
            var itemId = ctx.NextInt();

            var sCount = !ctx.Empty ? ctx.NextString() : null;
            var nCount = 1;

            if (sCount is object)
            {
                if (!int.TryParse(sCount, out nCount))
                {
                    ctx.Character.SendMessage("Unable to parse count.");
                    return;
                }
            }

            var character = ctx.Character;

            var nInvType = ItemConstants.GetInventoryType(itemId);

            if (InventoryManipulator.CountFreeSlots(character, nInvType) > 0)
            {
                var item = MasterManager.CreateItem(itemId);

                if (item is null)
                {
                    return;
                }

                if (item is GW_ItemSlotBundle isb)
                {
                    isb.nNumber = (short)Math.Min(nCount, item.SlotMax);
                }

                InventoryManipulator.InsertInto(character, item);
                character.SendPacket(CPacket.DropPickUpMessage_Item(itemId, nCount, true));
            }
        }
示例#26
0
        public void RemoveItem(CInPacket p)
        {
            // Recv [CP_MiniRoom] [90 00] [26] 01 00

            var nShopSlot = p.Decode2();

            var tItem = Inventory.GetAndRemove(nShopSlot);

            if (tItem is null)
            {
                // do nothing
            }
            else if (InventoryManipulator.CountFreeSlots(Parent, tItem.Item.InvType) <= 0)
            {
                Parent.SendMessage("Please make room in your inventory.");
            }
            else
            {
                InventoryManipulator.InsertInto(Parent, tItem.Item);
            }

            Refresh(Parent);
        }
示例#27
0
        public void AddItem(CInPacket p)
        {
            var nTI             = (InventoryType)p.Decode1();
            var nPOS            = p.Decode2();
            var nBundles        = Math.Max((short)1, p.Decode2());
            var nPricePerBundle = Math.Max((short)1, p.Decode2());
            var nPrice          = Math.Max(1, p.Decode4());

            var pItem = InventoryManipulator.GetItem(Parent, nTI, nPOS);

            if (pItem is null)
            {
                Parent.SendMessage("item is null u fucc");
                return;
            }

            var nQuantityRequested = -1; // negative so its removed completely from inventory

            if (!ItemConstants.is_treat_singly(pItem.nItemID))
            {
                nQuantityRequested = nBundles * nPricePerBundle;

                if (pItem.nNumber < nQuantityRequested)
                {
                    return; // f*****g retard
                }
            }

            InventoryManipulator.RemoveFrom(Parent, nTI, nPOS, (short)nQuantityRequested);
            Inventory.Add(new TempItem(pItem, nPrice, nPricePerBundle, nBundles));

            Refresh(Parent);

            Parent.SendMessage($"Bundles: {nBundles}, PricePerBundle: {nPricePerBundle}, Price: {nPrice}");

            // TODO packet editing checks
        }
示例#28
0
        /// <summary>
        /// Move an item from the character's storage to the character's account cash locker
        /// </summary>
        /// <param name="c"></param>
        /// <param name="p"></param>
        public static void MoveSToL(WvsShopClient c, CInPacket p)
        {
            if (p.Available < 9)
            {
                return;
            }

            var cashCommodityId = p.Decode8();
            var nTI             = (InventoryType)p.Decode1();

            var(itemSlot, item) = InventoryManipulator.GetItemByCashSN(c.Character, nTI, cashCommodityId);

            // unable to find item in inventory
            if (item is null)
            {
                return;
            }

            if (ItemConstants.IsRing(item.nItemID))
            {
                c.SendPacket(CPacket.CCashShop.RequestFailPacket(CashItemOps.CashItemRes_MoveStoL_Failed, CashItemFailed.NotAvailableTime));
                return;
            }

            var newItem = MasterManager.CreateCashCommodityItem(item.liCashItemSN);

            newItem.Item.nNumber     = item.nNumber;
            newItem.Item.liSN        = item.liSN;
            newItem.Item.tDateExpire = item.tDateExpire;
            //newItem.dwCharacterID = // TODO
            newItem.dwAccountID = c.Character.Account.ID;

            c.CashLocker.Add(newItem);
            InventoryManipulator.RemoveFrom(c.Character, nTI, itemSlot, -1);

            c.SendPacket(CPacket.CCashShop.MoveSToLResponse(c.CashLocker, newItem));
        }
示例#29
0
	public void initManipulator (InventoryManipulator manipulator) {
		this.manipulator = manipulator;
		foreach (InventoryCell cell in cells) {
			cell.setManipulator(manipulator);
		}
	}
示例#30
0
        public void PickUp(Character pChar, int dwDropId, short pX, short pY, bool bByPet = false)
        {
            var pDrop = this[dwDropId];

            if (pDrop is null)
            {
                return;
            }

            switch (pDrop.DropOwnType)
            {
            case DropOwnType.PartyOwn when pChar.Party?.PartyID != pDrop.DropOwnerID:
            case DropOwnType.UserOwn when pChar.dwId != pDrop.DropOwnerID:
                pChar.SendMessage("Trying to pick up a drop that doesn't belong to you.");
                return;
            }

            if (pDrop.Item != null)
            {
                if (InventoryManipulator.CountFreeSlots(pChar, ItemConstants.GetInventoryType(pDrop.Item.nItemID)) <= 0)
                {
                    return;
                }
            }

            if (bByPet)
            {
                if (Constants.MULTIPET_ACTIVATED)
                {
                    throw new NotImplementedException();                     // since we arent checking multiple pet equip slots
                }

                if (pDrop.bIsMoney == 1)
                {
                    if (InventoryManipulator.GetItem(pChar, BodyPart.BP_PETABIL_MESO, true) is null)
                    {
                        return;
                    }
                }
                else
                {
                    if (InventoryManipulator.GetItem(pChar, BodyPart.BP_PETABIL_ITEM, true) is null)
                    {
                        return;
                    }
                }

                pDrop.nLeaveType = DropLeaveType.PetPickup;
            }
            else
            {
                pDrop.nLeaveType = DropLeaveType.UserPickup;
            }

            pDrop.OwnerCharId = pChar.dwId;

            if (pDrop.bIsMoney > 0)
            {
                pChar.Modify.GainMeso(pDrop.nMesoVal);
            }
            else
            {
                if (pDrop.Item.Template is CashItemTemplate itemDataTemplate)
                {
                    if (itemDataTemplate.Max > 0 &&
                        InventoryManipulator.ContainsItem(pChar, pDrop.ItemId, (short)itemDataTemplate.Max))
                    {
                        pChar.SendMessage("Can't hold anymore of this item..");
                        return;
                    }
                }

                if (!Field.TryDropPickup(pChar, pDrop))
                {
                    return;
                }

                pChar.SendPacket(CPacket.DropPickUpMessage_Item(pDrop.ItemId, pDrop.Item.nNumber, false));

                if (pDrop.Item.Template.PickupMessage.Length > 0)
                {
                    pChar.SendMessage(pDrop.Item.Template.PickupMessage);
                }
            }

            Remove(dwDropId);
        }
        public QuestResultType TryExchange(int nIncMoney, QuestAct.ActItem[] aActItem)
        {
            if (nIncMoney == 0 && aActItem.Length <= 0)
            {
                return(QuestResultType.Success);
            }

            if (nIncMoney < 0 &&
                Parent.Stats.nMoney < nIncMoney)
            {
                return(QuestResultType.Failed_Meso);
            }

            foreach (var item in aActItem)
            {
                if (item.Item.Count > 0)
                {
                    if (!InventoryManipulator.HasSpace(Parent, item.Item.ItemID, (short)item.Item.Count))
                    {
                        return(QuestResultType.Failed_Inventory);                        // -> Etc inventory is full
                    }
                }
                else
                {
                    if (!InventoryManipulator.ContainsItem(Parent, item.Item.ItemID, (short)item.Item.Count))
                    {
                        return(QuestResultType.Failed_Unknown);                        // idk what code to give them
                    }
                }
            }

            Parent.Modify.GainMeso(nIncMoney);

            var weight = 0;

            foreach (var item in aActItem)
            {
                if (item.ProbRate != 0)
                {
                    weight += item.ProbRate;
                }
            }

            var itemGiven = false;

            foreach (var item in aActItem.Shuffle())
            {
                if (item.Item.Count < 0)
                {
                    InventoryManipulator.RemoveQuantity(Parent, item.Item.ItemID, (short)item.Item.Count);
                }
                else
                {
                    if (item.ProbRate == 0)
                    {
                        var newItem = MasterManager.CreateItem(item.Item.ItemID, false);
                        if (!newItem.IsEquip)
                        {
                            newItem.nNumber = (short)item.Item.Count;
                        }

                        InventoryManipulator.InsertInto(Parent, newItem);
                    }
                    else if (!itemGiven)
                    {
                        var rand = Constants.Rand.Next(0, weight);

                        if (rand < item.ProbRate)
                        {
                            var newItem = MasterManager.CreateItem(item.Item.ItemID, false);
                            if (!newItem.IsEquip)
                            {
                                newItem.nNumber = (short)item.Item.Count;
                            }

                            InventoryManipulator.InsertInto(Parent, newItem);
                            itemGiven = true;
                        }
                        else
                        {
                            weight -= item.ProbRate;
                        }
                    }
                }
            }

            return(QuestResultType.Success);
        }
        public bool CheckDemand(short nQuestID, int dwNpcTemplateID, int nAct)
        {
            // TODO proper response codes

            var pQuest = MasterManager.QuestTemplates[nQuestID];

            var pDemand = nAct == 0 ? pQuest.StartDemand : pQuest.EndDemand;

            if (pDemand is null)
            {
                return(true);                             // no requirements
            }
            var correctNpc = nAct == 0 ? pQuest.StartNPC : pQuest.EndNPC;

            if (correctNpc != 0 && correctNpc != dwNpcTemplateID)
            {
                return(false);
            }

            switch (nAct)
            {
            case 0 when this[nQuestID] is null:
                return(true);

            case 1 when this[nQuestID] is null:
            case 1 when this[nQuestID].nState == QuestActType.NotStarted:
            case 0 when this[nQuestID].nState == QuestActType.QuestAccept:
                return(false);

            default:
                if (this[nQuestID].IsComplete)
                {
                    return(false);
                }
                break;
            }

            if (Parent.Stats.nLevel < pDemand.LevelMin)
            {
                return(false);
            }
            if (Parent.Stats.nPOP < pDemand.Pop)
            {
                return(false);
            }
            if (pQuest.Start > DateTime.MinValue && pQuest.Start.SecondsSinceStart() < 0)
            {
                return(false);
            }

            // hmm the client is still allowing some quests that have an end date and max level to be triggered...
            //if (pQuest.End > DateTime.MinValue && pQuest.End.SecondsSinceStart() > 0) return false;
            //if (pDemand.LevelMax != 0 && Parent.Stats.nLevel > pDemand.LevelMax) return false;

            if (pDemand.SubJobFlags != 0 && Parent.Stats.nSubJob != pDemand.SubJobFlags)
            {
                return(false);
            }

            if (pDemand.Job.Length > 0 &&
                pDemand.Job.All(job => job != Parent.Stats.nJob))
            {
                return(false);
            }

            foreach (var item in pDemand.DemandItem)
            {
                if (ItemConstants.GetInventoryType(item.ItemID) == InventoryType.Equip)
                {
                    if (InventoryManipulator.ItemEquipped(Parent, item.ItemID))
                    {
                        continue;
                    }
                }

                if (!InventoryManipulator.ContainsItem(Parent, item.ItemID, (short)item.Count))
                {
                    return(false);
                }
            }

            if (pDemand.EquipAllNeed.Any(
                    item => !InventoryManipulator.ItemEquipped(Parent, item)))
            {
                return(false);
            }

            if (pDemand.EquipSelectNeed.Length > 0 && pDemand.EquipSelectNeed.All(             // TODO verify
                    item => !InventoryManipulator.ItemEquipped(Parent, item)))
            {
                return(false);
            }

            foreach (var quest in pDemand.DemandQuest)
            {
                if (quest.State == 0 && !Contains(quest.QuestID))
                {
                    return(false);
                }
                if ((QuestActType)quest.State != this[quest.QuestID].nState)
                {
                    return(false);
                }
            }

            foreach (var skill in pDemand.DemandSkill)
            {
                if (skill.Acquire == 0 && Parent.Skills[skill.SkillID]?.nSLV != 0)
                {
                    return(false);
                }
                if (Parent.Skills[skill.SkillID].nSLV == 0)
                {
                    return(false);
                }
            }

            foreach (var mob in pDemand.DemandMob)
            {
                var quest = this[nQuestID];
                if (!quest.DemandRecords.ContainsKey(mob.MobID))
                {
                    return(false);
                }
                if (quest.DemandRecords[mob.MobID].nValue != mob.Count)
                {
                    return(false);
                }
            }

            foreach (var map in pDemand.DemandMap)
            {
                var quest = this[nQuestID];
                if (!quest.DemandRecords.ContainsKey(map.MapID))
                {
                    return(false);
                }
                if (quest.DemandRecords[map.MapID].nValue <= 0)
                {
                    return(false);
                }
            }

            if (pDemand.FieldEnter.Length > 0 &&
                pDemand.FieldEnter.All(map => map == Parent.Stats.dwPosMap))
            {
                return(false);
            }

            // TODO taming mob
            // TODO pet closeness

            return(true);
        }
示例#33
0
	public void setManipulator (InventoryManipulator manipulator) {
		this.manipulator = manipulator;
	}
示例#34
0
        public override void Execute(CommandCtx ctx)
        {
            if (ctx.Empty)
            {
                ctx.Character.SendMessage("!test <ftype | event | makerskill>");
            }
            else
            {
                switch (ctx.NextString().ToLowerInvariant())
                {
                case "instance":
                    ctx.Character.SendMessage($"Instance: {ctx.Character.Field.nInstanceID}");
                    break;

                case "potential":
                    if (ctx.Empty)
                    {
                        return;
                    }

                    var itemid = ctx.NextInt();

                    var pots = new int[3];

                    var i = 0;
                    while (!ctx.Empty)
                    {
                        pots[i] = ctx.NextInt();
                        i      += 1;
                    }

                    var pItem = MasterManager.CreateItem(itemid, false) as GW_ItemSlotEquip;

                    if (pItem is null)
                    {
                        return;
                    }

                    pItem.nGrade = PotentialGradeCode.Visible_Unique;

                    pItem.nOption1 = (short)pots[0];
                    pItem.nOption2 = (short)pots[1];
                    pItem.nOption3 = (short)pots[2];

                    InventoryManipulator.InsertInto(ctx.Character, pItem);

                    break;

                case "sheepranch":
                    ctx.Character.Action.SetFieldInstance(BattlefieldData.BattleMap, 1);
                    break;

                case "sethorns":
                    ctx.Character.Buffs.AddSkillBuff((int)Skills.BOWMASTER_SHARP_EYES, 30);
                    ctx.Character.Buffs.AddSkillBuff((int)Skills.DUAL5_THORNS_EFFECT, 30);
                    break;

                case "makerskill":
                    ctx.Character.Skills.Add(new SkillEntry(1007)
                    {
                        nSLV = 1
                    });
                    break;

                case "ftype":
                    ctx.Character.SendMessage("Map Field Type: " + Enum.GetName(typeof(FieldType), ctx.Character.Field.Template.FieldType));
                    break;

                case "event":
                    MasterManager.EventManager.TryDoEvent(true);
                    break;

                case "shop":
                {
                    var pShop = new CShop(69);

                    pShop.Items.Add(new CShopItem(0));

                    pShop.AddDefaultItems();

                    MasterManager.ShopManager.InitUserShop(ctx.Character, 9900000, pShop);
                }
                break;

                case "balloon":
                    ctx.SendPacket(CPacket.BalloonMessage("Hello World!", 96));
                    break;

                default:
                    ctx.Character.SendMessage("No test command with that argument.");
                    break;
                }
            }

            return;

            foreach (var mob in ctx.Character.Field.Mobs)
            {
                ctx.Character.SendMessage($"{mob.nMobTemplateId}");
            }
            return;

            int imob = 0;

            foreach (var mob in ctx.Character.Field.Mobs.aMobGen)
            {
                if (mob.FH == 0)
                {
                    imob += 1;
                }
            }
            ctx.Character.SendMessage($"Mobs with FH 0: {imob}");
            ctx.Character.SendMessage($"Mobs In Map: {ctx.Character.Field.Mobs.Count} || Spawns: {ctx.Character.Field.Mobs.aMobGen.Count}");
            return;

            //foreach(var reactor in ctx.Character.Field.Reactors)
            //{
            //	reactor.IncreaseReactorState(0, 0);
            //}

            //return;
            ctx.Character.Action.SetFieldInstance(240060200, Constants.Rand.Next(), 0);

            return;

            var drop = new CDrop(ctx.Character.Position, ctx.Character.dwId)
            {
                ItemId = 100
            };

            drop.Position.X = drop.StartPosX;
            drop.CalculateY(ctx.Character.Field, drop.StartPosY);

            ctx.Character.Field.Drops.Add(drop);

            return;

            ctx.Character.SendMessage("" + Enum.GetName(typeof(FieldType), ctx.Character.Field.Template.FieldType));

            return;

            var p    = new COutPacket(SendOps.LP_Clock);
            var type = ctx.NextInt();

            p.Encode1((byte)type);
            switch (type)
            {
            case 0:                       // OnEventTimer
                p.Encode4(ctx.NextInt()); // nDuration

                break;

            case 1:                             // Clock
                p.Encode1((byte)ctx.NextInt()); // nHour
                p.Encode1((byte)ctx.NextInt()); // nMin
                p.Encode1((byte)ctx.NextInt()); // nSec

                break;

            case 2:                       // Timer
                p.Encode4(ctx.NextInt()); // tDuration (0 to disable the clock)

                break;

            case 3:                             // some kind of event timer also
                p.Encode1((byte)ctx.NextInt()); // bool (on/off)
                p.Encode4(ctx.NextInt());       // tDuration

                break;

            case 100:                           // cakepie event timer
                p.Encode1((byte)ctx.NextInt()); // bool (timer on/off)
                p.Encode1((byte)ctx.NextInt()); // nTimerType
                p.Encode4(ctx.NextInt());       // tDuration

                break;
            }

            ctx.Character.SendPacket(p);

            for (int i = 0; i < 2; i++)
            {
                var p2 = new COutPacket(SendOps.LP_CakePieEventResult);
                p2.Encode1(1);                         // bool -> continue while loop
                p2.Encode4(ctx.Character.Field.MapId); // fieldid
                p2.Encode4(4220176);                   // itemid
                p2.Encode1(25);                        // percentage
                p2.Encode1((byte)ctx.NextInt());       // eventstatus
                p2.Encode1((byte)(i + 1));             // nwinnerteam
                p2.Encode1(0);                         // end while loop

                ctx.SendPacket(p2);
            }

            return;

            //var poo = ctx.Character.Pets.Pets[0];

            //if (poo != null)
            //{
            //	ctx.Character.SendMessage($"{poo.Position.X} || {poo.Position.Y}");
            //}

            //var p = new COutPacket(SendOps.LP_AvatarMegaphoneUpdateMessage);
            //var x = new AvatarMegaphone
            //{
            //	nItemID = 05390000,
            //	sName = "pooodop",
            //	sMsgs = new string[5] { "one", "  two", " three", "    four", " five" },
            //	nChannelNumber = 1,
            //	bWhisper = true,
            //	alSender = ctx.Character.GetLook()
            //};

            //x.Encode(p);

            //MasterManager.CharacterPool.Broadcast(p);

            //var nItemID = ctx.NextInt();

            //ctx.Character.Modify.Inventory(inv =>
            //{
            //	for (short i = 1; i <= ctx.Character.InventoryEquip.SlotLimit; i++)
            //	{
            //		ctx.Character.InventoryEquip.Remove(i);
            //		var newItem = MasterManager.CreateItem(nItemID) as GW_ItemSlotEquip;
            //		newItem.nGrade = PotentialGradeCode.Visible_Unique;
            //		newItem.nOption1 = (int)PotentialLineIDs.LEARN_SKILL_HASTE;
            //		ctx.Character.InventoryEquip.Add(i, newItem);
            //		inv.Add(InventoryType.Equip, i, newItem);
            //	}

            //	var magnifyingGlass = MasterManager.CreateItem(02460003) as GW_ItemSlotBundle;
            //	magnifyingGlass.nNumber = 500; // pretty sure i can override the 100 slotmax lol
            //	ctx.Character.InventoryConsume.Remove(15);
            //	ctx.Character.InventoryConsume.Add(15, magnifyingGlass);

            //	inv.Remove(InventoryType.Consume, 15);
            //	inv.Add(InventoryType.Consume, 15, magnifyingGlass);

            //});

            //return;

            //foreach (var item in ctx.Character.InventoryEquip)
            //{
            //	ctx.Character.Action.ConsumeItem.UseMagnifyingGlass(15, item.Key);
            //	item.Value.sTitle = $"{item.Value.nOption1}|{item.Value.nOption2}";
            //}

            //ctx.Character.InventoryEquip.RemoveAllItems(ctx.Character); // gotta cc for this to take effect so we can look then cc to clean inv

            // ctx.Character.SendPacket(CPacket.UserOpenUI((UIWindow)ctx.NextInt()));

            //ctx.Character.Field.bPauseSpawn = !ctx.Character.Field.bPauseSpawn;

            //ctx.Character.Modify.Stats(mod => mod.SP += (short)ctx.NextInt());

            //var p = new COutPacket(SendOps.LP_UserEffectLocal);

            //for (int i = 8; i >= 1; i--)
            //{
            //    p.Encode4(i == statup.getPosition() ? statup.getValue() : 0);
            //}

            //p.Encode1(1); // skill use
            //p.Encode4(22160000); // skillID
            //p.Encode1(100); // nCharLevel
            //p.Encode1(1); // nSLV
            //p.Encode1(1);

            //ctx.SendPacket(p);

            //ctx.Character.SendMessage($"You have {ctx.Character.Buffs.Count} buffs.");

            //var pChar = ctx.Character;

            //if (pChar.PlayerGuild == null)
            //{
            //    var name = ctx.NextString();
            //    MasterManager.GuildManager.Add(new Guild(name, pChar.dwId));
            //}
            //else
            //{
            //    var p = new COutPacket(SendOps.LP_GuildResult);
            //    p.Encode1((byte)ctx.NextInt());

            //    pChar.SendPacket(p);
            //}
            //var storage = ServerApp.Container.Resolve<CenterStorage>();
            //var sub = storage.Multiplexer().GetSubscriber();

            //sub.Publish("donate", $"{character.AccId}/5000");

            // character.Modify.GainNX(1000);

            // character.SendPacket(CPacket.OpenClassCompetitionPage());

            //var stat = new SecondaryStat();

            //var entry = new SecondaryStatEntry()
            //{
            //    nValue = 10,
            //    rValue = 2001002,
            //    tValue = 110000,
            //};

            //stat.Add(SecondaryStatType.MagicGuard, entry);
            //stat.Add(SecondaryStatType.Flying, entry);

            //character.SendPacket(CPacket.TemporaryStatSetLocal(stat));
            //character.Field.Broadcast(CPacket.UserTemporaryStatSet(stat, character.CharId));

            //var summon = new CSummon();
            //summon.Parent = character;
            //summon.dwSummonedId = 2330810;
            //summon.nSkillID = 14001005;

            //summon.Position.Position.X = character.Position.Position.X;
            //summon.Position.Position.Y = character.Position.Position.Y;
            //summon.Position.Foothold = character.Position.Foothold;

            //summon.nCharLevel = character.Stats.nLevel;
            //summon.nSLV = 1;
            //summon.bMoveAbility = 1;
            //summon.bAssistType = 1;
            //summon.nEnterType = 1;

            //character.Summons.Add(summon);

            //character.SendPacket(CPacket.TradeMoneyLimit(true));
            //character.SendPacket(CPacket.WarnMessage("YEOOOOOO THIS IS A WARNING BOY"));
            //character.SendPacket(CPacket.AdminShopCommodity(9900000));
            //character.SendPacket(CPacket.StandAloneMode(true));
            //character.SendPacket(CPacket.LogoutGift());

            //character.SendPacket(CPacket.UserHireTutor(true));
            //character.SendPacket(CPacket.UserTutorMsg(Constants.ServerMessage2,400,60000));

            //character.SendPacket(CPacket.HontaleTimer(0,5));
            //character.SendPacket(CPacket.HontaleTimer(1, 5));
            //character.SendPacket(CPacket.HontaleTimer(2, 5));
            //character.SendPacket(CPacket.HontaleTimer(3, 5));

            //character.SendPacket(CPacket.HontailTimer(0,69));
            //character.SendPacket(CPacket.HontailTimer(1, 69));
            //character.SendPacket(CPacket.HontailTimer(0, 0));

            //var town = new CTownPortal();
            //town.dwCharacterID = character.dwId;
            //town.Position.X = character.Position.X;
            //town.Position.Y = character.Position.Y;

            //character.Field.TownPortals.Add(town);

            //character.SendPacket(CPacket.DragonEnterField(character.dwId, character.Position.X, character.Position.Y, 0, 2218));
            //character.Dragon = new CDragon(character);
            //character.Dragon.JobCode = 2218;
            //character.Dragon.Position.X = character.Position.X;
            //character.Dragon.Position.Y = character.Position.Y;


            //    var gate1 = new COpenGate()
            //    {
            //        dwCharacterID = character.dwId,
            //    };

            //    gate1.Position.X = character.Position.X;
            //    gate1.Position.Y = character.Position.Y;

            //    character.Field.OpenGates1.Add(gate1);

            //    var gate2 = new COpenGate()
            //    {
            //        dwCharacterID = character.dwId,
            //    };

            //    gate2.Position.X = character.Position.X;
            //    gate2.Position.X -= 250;

            //    gate2.Position.Y = character.Position.Y;

            //    character.Field.OpenGates2.Add(gate2);


            //character.SendPacket(CPacket.StageChange("ThemeBack1.img", 0));

            //character.Field.Employees.RemoveAt(0);

            //character.SendPacket(CPacket.SetBackgroundEffect(2, 100000000, 1, 30 * 1000));

            //character.SendPacket(CPacket.Desc(true));

            //character.SendPacket(CPacket.StalkResult(character.dwId, character.Stats.sCharacterName, character.Position.X, character.Position.Y));

            //character.SendPacket(CPacket.PlayJukeBox("Hydromorph"));
            //character.SendPacket(CPacket.BlowWeather(0, 5120000, "Hello Twitch!!!"));

            //character.SendPacket(CPacket.AntiMacroResult(6, "SnitchNigga")); //Crash
            //character.SendPacket(CPacket.AntiMacroResult(7, "SnitchNigga")); //This dude reported you !

            //Diemension mirror reeeeeeeeeeeeeee
            //var p = NpcScript.ScriptMessageHeader(0, 9900000, ScriptMsgType.AskSlideMenu);
            //p.Encode4(0); //dlg type
            //p.Encode4(0); //index?
            //p.EncodeString("Hello World");
            //character.SendPacket(p);

            //var pet = new CPet(ctx.Character);
            //pet.nIdx = 0;
            //pet.liPetLockerSN = 9001;
            //pet.dwTemplateID = 5000102;
            //pet.sName = "Charlie";
            //pet.Position.X = character.Position.X;
            //pet.Position.Y = character.Position.Y;

            //ctx.Character.Pets.Add(pet.liPetLockerSN, pet);
        }