示例#1
0
        void ParseEngineCommand(string[] commandData)
        {
            switch (commandData[0])
            {
            case "addobj":
                starter.AttemptAddObjective(commandData[1]);
                Log.Info(commandData[1] + " added");
                break;

            case "follow":
                (convPartner.Intellect as CompanionUnitAI).ToFollow = starter;
                break;

            case "stop":
                (convPartner.Intellect as CompanionUnitAI).ToFollow = null;
                break;

            case "weaponusebest":
                convPartner.SetBestWeapon();
                Log.Info("{0} equipped {1}", convPartner.Name, convPartner.ActiveHeldItem.Type.Name);
                break;

            case "weaponputaway":
                convPartner.ResetSlot(convPartner.PrimaryActive);
                break;

            case "quit":
                EngineApp.Instance.SetNeedExit();
                break;

            case "attack":
                VBFactionManager.Instance.GetFactionItemByType(convPartner.InitialFaction).Enemies.Add(starter.InitialFaction);
                break;

            case "kill":
                convPartner.Die();
                break;

            case "setobjstatus":
                VBFactionManager.Instance.GetFactionItemByType(starter.InitialFaction).ObjectiveManager.SetObjectiveStatus(commandData[1], Convert.ToInt32(commandData[2]));
                break;

            case "getsex":
                if (commandData[1] == "tramp")
                {
                    Log.Info("You just had sex with a tramp. Well aren't you SPECIAL...");
                }
                break;

            default:
                break;
            }
        }
示例#2
0
        void SetSlot(SlotHolder _sender, SlotHolder _receiver)
        {
            if (_receiver.holderType > SlotHolder.HolderType.Inventory)
            {
                //TODO: SWAP ITEMS IN INVENTORY
                if (_receiver.Controls.Count != 0)
                {
                    return;
                }

                //TODO: MAKE RECEIVER CHECK FOR ITEM TYPE

                VBCharacter chSnd = _sender.owner as VBCharacter;
                switch (_receiver.holderType)
                {
                case SlotHolder.HolderType.Armor:
                    //set player armor
                    break;

                case SlotHolder.HolderType.Slot1:
                    if (chSnd != null)
                    {
                        chSnd.SetItem(assignedItem, true);
                    }
                    break;

                case SlotHolder.HolderType.Slot2:
                    if (chSnd != null)
                    {
                        chSnd.SetItem(assignedItem, false);
                    }
                    break;

                case SlotHolder.HolderType.Drop:
                    _sender.owner.DropItem(assignedItem);
                    break;
                }
            }
            else
            {
                if (_sender.holderType == SlotHolder.HolderType.Inventory)
                {
                    if (_receiver.owner.CanHoldItem(assignedItem.ItemType))
                    {
                        _sender.owner.Inventory.Remove(assignedItem);
                        _receiver.owner.Inventory.Add(assignedItem);
                    }
                    else
                    {
                        return;  //full stop
                    }
                }
            }

            //TODO: THE PROBLEM WITH THIS SYSTEM IS THAT OBJECTS CANNOT BE SWAPPED BETWEEN SLOTS, INSTEAD OF NOT ACCEPTING THE NEW HOLDER REMOVE THE PREVIOUS ONE

            //if my sender is on primary or secondary reset its slot
            VBCharacter chRec = _receiver.owner as VBCharacter;

            if (chRec != null)
            {
                if (_sender.holderType == SlotHolder.HolderType.Slot1)
                {
                    chRec.ResetSlot(true);
                }

                if (_sender.holderType == SlotHolder.HolderType.Slot2)
                {
                    chRec.ResetSlot(false);
                }
            }

            //if my quantity is > 1, then instead of swapping the slot, add a new identical one to the receiver
            //and decrease the quntity to the initial one while strring the new one to 0

            if (quantity > 1 && (assignedItem.ItemType as AmmoItemType) == null)
            {
                if (_receiver.holderType != SlotHolder.HolderType.Drop)
                {
                    //create a new and identical slot but with the assigned item of the other object
                    TestSlot stmp = new TestSlot(_sender.GetFirstOfTypeUnassignedItem(assignedItem.ItemType));
                    _receiver.Controls.Add(stmp);
                }

                SetQuantity(quantity - 1);
            }
            else
            {
                Position = new ScaleValue(ScaleType.ScaleByResolution, Vec2.Zero);
                Parent.Controls.Remove(this);

                if (_receiver.holderType != SlotHolder.HolderType.Drop && !_receiver.FoundAndUpdatedEntry(assignedItem))
                {
                    _receiver.Controls.Add(this);
                }
            }
        }