コード例 #1
0
 public NullMovement(CreatureObject parent)
     : base(parent)
 {
     _position       = _creature.SpawnPosition;
     _rotation       = _creature.SpawnRotation;
     parent.OnSpawn += NullMovement_OnSpawn;
 }
コード例 #2
0
 public InventoryItem(Rectangle _Bounds, Container _Parent, CreatureObject _InventoryOwner)
     : base(_Bounds)
 {
     this.itemObject     = null;
     this.parent         = _Parent;
     this.inventoryOwner = _InventoryOwner;
 }
コード例 #3
0
        public void AddPartyEnemy(CreatureObject PartyEnemy)
        {
            if (PartyEnemy == null)
            {
                throw new ApplicationException("Trying to add party enemy, but that creature does not exist.");
            }
            if (!Enemies.Contains(PartyEnemy))
            {
                Enemies.Add(PartyEnemy);
            }

            if (CanPartySee(PartyEnemy))
            {
                int EnemyArmorRank = PartyEnemy.Script.GetArmorRank(PartyEnemy.Script.GetItemInSlot(CLRScriptBase.INVENTORY_SLOT_CARMOUR, PartyEnemy.ObjectId));
                if ((EnemyArmorRank == CLRScriptBase.ARMOR_RANK_HEAVY ||
                     EnemyArmorRank == CLRScriptBase.ARMOR_RANK_MEDIUM) &&
                    !EnemyHardTargets.Contains(PartyEnemy))
                {
                    EnemyHardTargets.Add(PartyEnemy);
                }
                if (EnemyArmorRank == CLRScriptBase.ARMOR_RANK_LIGHT ||
                    EnemyArmorRank == CLRScriptBase.ARMOR_RANK_NONE)
                {
                    EnemySoftTargets.Add(PartyEnemy);
                }
                if (_LooksLikeSpellcaster(PartyEnemy))
                {
                    EnemySpellcasters.Add(PartyEnemy);
                }
            }
            else
            {
                EnemiesLost.Add(PartyEnemy);
            }
        }
コード例 #4
0
        public CreatureObject GetNearest(CreatureObject Source, List <CreatureObject> Creatures)
        {
            AreaObject     SourceArea = Source.Area;
            Vector3        SourcePos  = Source.Position;
            CreatureObject RetValue   = null;

            if (Creatures.Count == 0)
            {
                return(RetValue);
            }

            float ShortestDistance = -1.0f;

            foreach (CreatureObject Target in Creatures)
            {
                // Only interested in objects in the same area.
                if (SourceArea != Target.Area)
                {
                    continue;
                }

                Vector3 TargetPos = Target.Position;
                float   Distance  = MathOps.DistanceSq(SourcePos, TargetPos);

                if ((ShortestDistance < 0) || (Distance < ShortestDistance))
                {
                    ShortestDistance = Distance;
                    RetValue         = Target;
                }
            }
            return(RetValue);
        }
コード例 #5
0
        public void RemovePartyEnemy(CreatureObject PartyEnemy)
        {
            if (Enemies.Contains(PartyEnemy))
            {
                Enemies.Remove(PartyEnemy);
            }

            if (EnemyHardTargets.Contains(PartyEnemy))
            {
                EnemyHardTargets.Remove(PartyEnemy);
            }

            if (EnemySoftTargets.Contains(PartyEnemy))
            {
                EnemySoftTargets.Remove(PartyEnemy);
            }

            if (EnemySpellcasters.Contains(PartyEnemy))
            {
                EnemySpellcasters.Remove(PartyEnemy);
            }

            if (EnemyHealers.Contains(PartyEnemy))
            {
                EnemyHealers.Remove(PartyEnemy);
            }
        }
コード例 #6
0
        public CreatureObject GetFarthest(CreatureObject Source, List <CreatureObject> Creatures)
        {
            AreaObject     SourceArea = Source.Area;
            Vector3        SourcePos  = Source.Position;
            CreatureObject RetValue   = null;

            if (Creatures.Count == 0)
            {
                return(RetValue);
            }

            float LongestDistance = -1.0f;

            foreach (CreatureObject Target in Creatures)
            {
                // Only interested in objects in the same area.
                if (SourceArea != Target.Area)
                {
                    continue;
                }

                Vector3 TargetPos = Target.Position;
                float   Distance  = MathOps.DistanceSq(SourcePos, TargetPos);

                if ((LongestDistance < 0) || ((Distance > LongestDistance) && (Distance < 100.0f * 100.0f))) // 100 meters is about as far as we'd expect combat to reach.
                {
                    LongestDistance = Distance;
                    RetValue        = Target;
                }
            }
            return(RetValue);
        }
コード例 #7
0
        //Dient nur zum wechseln! Ohne Senden! EHER für host
        public void changeItemPosition(CreatureObject _InventoryOwner, int _OldPosition, int _NewPosition)
        {
            ItemObject var_ItemToChange = null;

            foreach (ItemObject var_ItemObject in this.items)
            {
                if (var_ItemObject.PositionInInventory == _OldPosition)
                {
                    var_ItemToChange = var_ItemObject;
                    break;
                }
            }

            if (var_ItemToChange != null)
            {
                if (_NewPosition == -1)
                {
                    this.items.Remove(var_ItemToChange);
                    var_ItemToChange.PositionInInventory = _NewPosition;
                    var_ItemToChange.Position            = new Microsoft.Xna.Framework.Vector3(40, 40, 0) + _InventoryOwner.Position;
                    World.world.addObject(var_ItemToChange);
                }
                else
                {
                    //TODO: Gucke ob an __NewPosition kein objekt!
                    var_ItemToChange.PositionInInventory = _NewPosition;
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// This function seeks signs of a spellcaster, looking for visible paraphenalia. Visibility is assumed, and should be checked separately.
        /// </summary>
        /// <param name="Creature">The creature to be assessed</param>
        /// <returns>True if there is some visible paraphenalia that suggests spellcasting.</returns>
        private bool _LooksLikeSpellcaster(CreatureObject Creature)
        {
            int VisibleSpellbooks = 0;

            foreach (uint Item in Creature.Script.GetItemsInInventory(Creature.ObjectId))
            {
                if (Creature.Script.GetTag(Item) == "ACR_MOD_SPELLBOOK" ||
                    Creature.Script.GetTag(Item) == "ACR_MOD_HOLYSYMBOL")
                {
                    VisibleSpellbooks++;
                }
                if (Creature.Script.GetHasInventory(Item) == CLRScriptBase.TRUE)
                {
                    foreach (uint ContainerContents in Creature.Script.GetItemsInInventory(Item))
                    {
                        if (Creature.Script.GetTag(ContainerContents) == "ACR_MOD_SPELLBOOK" ||
                            Creature.Script.GetTag(ContainerContents) == "ACR_MOD_HOLYSYMBOL")
                        {
                            VisibleSpellbooks--;
                        }
                    }
                }
            }
            if (VisibleSpellbooks > 0)
            {
                return(true);
            }
            return(false);
        }
コード例 #9
0
ファイル: WO_MOB.cs プロジェクト: Ignis34Rus/LoE-Ghost.Server
        private void WO_MOB_OnKilled(CreatureObject obj)
        {
            var awards = _threat.ToAward;

            if (awards.Length > 0)
            {
                var bonus = (uint)(_stats.Level * (awards.Length - 1));
                if (_creature.LootID > 0)
                {
                    if (DataMgr.Select(_creature.LootID, out DB_Loot loot))
                    {
                        new WO_Loot(loot, this, awards[0].Player, _manager);
                    }
                }
                awards[0].Player.Stats.AddExp(TalentMarkId.Combat, (uint)_stats.Level * Constants.LevelExpMultipler, bonus);
                for (uint i = 1; i < awards.Length; i++)
                {
                    awards[i].Player.Stats.AddExp(TalentMarkId.Combat, (uint)(_stats.Level * Constants.LevelExpMultipler / i), bonus / i);
                }
            }
            if ((_data.Flags & 1) == 1)
            {
                Despawn();
            }
            else
            {
                Destroy();
            }
        }
コード例 #10
0
 public override bool SelectTarget(out CreatureObject target)
 {
     target = null;
     if (_threat.Count > 0)
     {
         foreach (var item in _threat.ToArray())
         {
             if (!item.Key.IsSpawned || item.Key.IsDead || Vector3.DistanceSquared(item.Key.Position, _creature.Position) > Constants.MaxSpellsDistanceSquared)
             {
                 if (item.Key.IsSpawned)
                 {
                     _creature.View.SetCombat(item.Key.Owner, false);
                 }
                 _threat.Remove(item.Key);
             }
         }
     }
     foreach (var item in _creature.Manager.GetPlayersInRadius(_creature, Constants.MaxInteractionDistance))
     {
         if (!_threat.ContainsKey(item))
         {
             _creature.View.SetCombat(item.Owner, true);
             _threat[item] = item.Player.Char.Level;
         }
     }
     return((target = _threat.OrderByDescending(x => x.Value).FirstOrDefault().Key) != null);
 }
コード例 #11
0
    void GenerateSplicedCreature()
    {
        Debug.Log("Generating new Spliced Creature");
        List <int> bodyPartIndecies = new List <int> {
            0, 1, 2, 3, 4
        };
        int varieties = bodyPartIndecies.Count / splicedDNA.Count;
        int remainder = bodyPartIndecies.Count - (varieties * splicedDNA.Count);

        Debug.Log("Varieties: " + varieties);
        List <int> varietyCounter = new List <int> ();

        for (int i = 0; i < splicedDNA.Count; i++)
        {
            varietyCounter.Add(varieties);
        }
        while (remainder > 0)
        {
            varietyCounter[Random.Range(0, varietyCounter.Count)]++;
            remainder--;
        }
        Debug.Log("Variety Counter: " + varietyCounter[0] + ", " + varietyCounter[1]);

        for (int i = 0; i < varietyCounter.Count; i++)
        {
            while (varietyCounter[i] > 0)
            {
                int newIndex = Random.Range(0, bodyPartIndecies.Count);

                switch (bodyPartIndecies[newIndex])
                {
                case 0:
                    head = splicedDNA[i].creatureType;
                    jaw  = splicedDNA[i].creatureType;
                    break;

                case 1:
                    body = splicedDNA[i].creatureType;
                    break;

                case 2:
                    tail = splicedDNA[i].creatureType;
                    break;

                case 3:
                    frontLegs = splicedDNA[i].creatureType;
                    break;

                case 4:
                    backLegs = splicedDNA[i].creatureType;
                    break;
                }

                varietyCounter[i]--;
                bodyPartIndecies.RemoveAt(newIndex);
            }
        }
    }
コード例 #12
0
 public bool TryGetCreature(ushort guid, out CreatureObject obj)
 {
     obj = null;
     if (_nvObjects.TryGetValue(guid, out var ret) || _plObjects.TryGetValue(guid, out ret))
     {
         obj = ret as CreatureObject;
     }
     return(obj != null);
 }
コード例 #13
0
    public override void OnEnter(AIState previousState)
    {
        base.OnEnter(previousState);
        this.Priority = 0;

        characterHealth = CreatureObject.GetComponent <CharacterHealth>();

        characterHealth.DealtDamage += OnDealtDamage;
    }
コード例 #14
0
 public PetMovement(CreatureObject parent)
     : base(parent)
 {
     _entry            = new SyncEntry();
     _position         = _creature.SpawnPosition;
     _rotation         = _creature.SpawnRotation;
     parent.OnSpawn   += PetMovement_OnSpawn;
     parent.OnDestroy += PetMovement_OnDestroy;
 }
コード例 #15
0
        /// <summary>
        /// Loads the creature from file.
        /// </summary>
        /// <returns>The status from file.</returns>
        /// <param name="status">Status.</param>
        public static CreatureObject LoadCreatureFromFile(CreatureObject _object)
        {
            m_Path = Load("cc_preset");
            if (m_Path.Length == 0)
            {
                return(_object);
            }

            return(LoadObjectFromFile <CreatureObject>(_object));
        }
コード例 #16
0
        /// <summary>
        /// Saves the creature to file.
        /// </summary>
        /// <param name="status">Status.</param>
        public static void SaveCreatureToFile(CreatureObject _object, string owner)
        {
            m_Path = Save(owner, "cc_preset");
            if (m_Path.Length == 0)
            {
                return;
            }

            SaveObjectToFile <CreatureObject>(_object);
        }
コード例 #17
0
        public static bool CanCast(CreatureObject creature, TargetEntry target)
        {
            DB_Spell spell; DB_SpellEffect main; CreatureObject targetCO;

            if (DataMgr.Select(target.SpellID, out spell) &&
                spell.Effects.TryGetValue(0, out main) &&
                creature.Stats.Energy >= main.Data01)
            {
                if (target.HasGuid)
                {
                    if (creature.Server.Objects.TryGetCreature((ushort)target.Guid, out targetCO) && !targetCO.IsDead)
                    {
                        if (Vector3.DistanceSquared(targetCO.Position, creature.Position) <= main.Data02 * main.Data02)
                        {
                            var isSelf = targetCO == creature;
                            if ((main.Target & SpellTarget.Creature) != 0)
                            {
                                if (targetCO.IsPlayer)
                                {
                                    if ((main.Target & SpellTarget.Self) != 0 && isSelf)
                                    {
                                        return(true);
                                    }
                                    else if ((main.Target & SpellTarget.Player) != 0)
                                    {
                                        return(targetCO.IsPlayer && !isSelf);
                                    }
                                }
                                else
                                {
                                    return(targetCO.HasStats);
                                }
                            }
                            else if ((main.Target & SpellTarget.Player) != 0)
                            {
                                if (isSelf)
                                {
                                    return((main.Target & SpellTarget.Self) != 0);
                                }
                                return(targetCO.IsPlayer);
                            }
                            else if ((main.Target & SpellTarget.Self) != 0)
                            {
                                return(isSelf);
                            }
                        }
                    }
                }
                else if ((main.Target & SpellTarget.Position) != 0)
                {
                    return(Vector3.DistanceSquared(target.Position, creature.Position) <= main.Data02 * main.Data02);
                }
            }
            return(false);
        }
コード例 #18
0
        /// <summary>
        /// Promote a creature in the party to party leader.
        /// </summary>
        /// <param name="PartyLeader">Supplies the new party leader.</param>
        public void PromotePartyLeader(CreatureObject PartyLeader)
        {
            if (PartyLeader != null)
            {
                if (PartyLeader.Party != this)
                {
                    throw new ApplicationException(String.Format(
                                                       "Trying to promote creature {0} to party leader, but it is not in this party.",
                                                       PartyLeader));
                }
            }

            this.PartyLeader = PartyLeader;
        }
コード例 #19
0
        public InventoryField(CreatureObject _InventoryOwner, int _FieldId, Rectangle _Bounds)
            : base(_Bounds)
        {
            this.inventoryOwner = _InventoryOwner;

            this.fieldId = _FieldId;

            /*this.itemSpace = new Component(new Rectangle(this.Bounds.X, this.Bounds.Y, this.Bounds.Width, this.Bounds.Height));
             * this.itemSpace.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryItemSpace";
             * this.add(this.itemSpace);*/

            //this.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryItemSpace";

            this.item = null;
        }
コード例 #20
0
 public ScriptedMovement(ushort id, CreatureObject parent)
     : base(parent)
 {
     _state     = 0;
     _entry     = new SyncEntry();
     _direction = Vector3.UnitZ;
     _position  = _creature.SpawnPosition;
     _rotation  = _creature.SpawnRotation.ToRadians();
     if (DataMgr.Select(id, out _entries))
     {
         Execute();
     }
     parent.OnSpawn   += ScriptedMovement_OnSpawn;
     parent.OnDestroy += ScriptedMovement_OnDestroy;
 }
コード例 #21
0
 public ScriptedMovement(ScriptedMovement original, CreatureObject clone)
     : base(clone)
 {
     _speed           = original._speed;
     _state           = original._state;
     _entry           = new SyncEntry();
     _entries         = original._entries;
     _current         = original._current;
     _waiting         = original._waiting;
     _position        = original.Position;
     _rotation        = original.Rotation;
     _direction       = original._direction;
     clone.OnSpawn   += ScriptedMovement_OnSpawn;
     clone.OnDestroy += ScriptedMovement_OnDestroy;
 }
コード例 #22
0
 public void AddToSelection()
 {
     if (tubeSelection)
     {
         CreatureObject creature = SpliceManager.instance.allCreatureTypes[buttonSelectedIndex];
         if (selectedCreatures.Contains(creature))
         {
             selectedCreatures.Remove(creature);
         }
         else
         {
             selectedCreatures.Add(creature);
         }
         tubeButtons[buttonSelectedIndex].GetComponent <UIButtonSelected> ().Selected();
         buttonGenerate.interactable = selectedCreatures.Count >= 2;
     }
 }
コード例 #23
0
        /// <summary>
        /// Get the C# creature object for the given object id.
        /// </summary>
        /// <param name="ObjectId">Supplies the object id to look up.</param>
        /// <param name="CreateIfNeeded">If true, the C# Creature object for
        /// the creature is created if the object didn't already exist.</param>
        /// <returns>The corresponding C# Creature object, else null.</returns>
        public CreatureObject GetCreatureObject(uint ObjectId, bool CreateIfNeeded = false)
        {
            CreatureObject Creature = (CreatureObject)GetGameObject(ObjectId, GameObjectType.Creature);

            if (Creature != null)
            {
                return(Creature);
            }
            else if (CreateIfNeeded && Script.GetObjectType(ObjectId) == CLRScriptBase.OBJECT_TYPE_CREATURE)
            {
                return(new CreatureObject(ObjectId, this));
            }
            else
            {
                return(null);
            }
        }
コード例 #24
0
 public WO_VoidZone(CreatureObject onwer, DB_Spell spell, DB_SpellEffect main)
     : base(onwer.Manager.GetNewGuid() | Constants.DRObject, onwer.Manager)
 {
     _main           = main;
     _spell          = spell;
     _onwer          = onwer;
     _position       = onwer.Position;
     _ticks          = (int)main.AttackModifer;
     OnUpdate       += WO_VoidZone_OnUpdate;
     OnDestroy      += WO_VoidZone_OnDestroy;
     _targets        = new List <CreatureObject>();
     _addedTargets   = new List <CreatureObject>();
     _removedTargets = new List <CreatureObject>();
     _update         = _period = (int)(main.LevelModifer * 1000) / _ticks;
     _hasAura        = spell.Effects.Values.Any(x => x.Type == SpellEffectType.AuraModifier);
     Spawn();
 }
コード例 #25
0
        public EquipmentField(CreatureObject _InventoryOwner, int _FieldId, List <ItemEnum> _AcceptedItemTypes, Rectangle _Bounds)
            : base(_Bounds)
        {
            this.inventoryOwner = _InventoryOwner;

            this.fieldId = _FieldId;

            this.acceptedItemTypes = _AcceptedItemTypes;

            this.AllowsDropIn = true;

            /*this.itemSpace = new Component(new Rectangle(this.Bounds.X, this.Bounds.Y, this.Bounds.Width, this.Bounds.Height));
             * this.itemSpace.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryItemSpace";
             * this.add(this.itemSpace);*/

            //this.BackgroundGraphicPath = "Gui/Menu/Inventory/InventoryItemSpace";

            this.item = null;
        }
コード例 #26
0
        //Sendet Änderung zum clienten bzw. server.
        public void changeItemPosition(CreatureObject _InventoryOwner, ItemObject _ItemObject, int _NewPosition)
        {
            int var_OldPosition = _ItemObject.PositionInInventory;

            _ItemObject.PositionInInventory = _NewPosition;
            if (var_OldPosition == _NewPosition)
            {
            }
            else
            {
                //Sende jeweilige Änderung
                if (Configuration.Configuration.isHost)
                {
                }
                else
                {
                    Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureInventoryItemPositionChangeMessage(_InventoryOwner.Id, var_OldPosition, _NewPosition), GameMessageImportance.VeryImportant);
                }
            }
        }
コード例 #27
0
 public void dropItem(CreatureObject _InventoryOwner, ItemObject _ItemObject)
 {
     if (Configuration.Configuration.isHost)
     {
     }
     else
     {
         if (Configuration.Configuration.isSinglePlayer)
         {
             changeItemPosition(_InventoryOwner, _ItemObject.PositionInInventory, -1);
         }
         else
         {
             Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureInventoryItemPositionChangeMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, -1), GameMessageImportance.VeryImportant);
         }
     }
     this.items.Remove(_ItemObject);
     this.InventoryChanged = true;
     inventoryChangedEvent.Invoke(this, new ItemChangedArg(_ItemObject));
 }
コード例 #28
0
 private void WO_VoidZone_OnDestroy()
 {
     if (_hasAura)
     {
         foreach (var item in _targets)
         {
             if (item.IsSpawned)
             {
                 item.Stats.RemoveAuraEffects(_guid);
             }
         }
     }
     _onwer = null;
     _targets.Clear();
     _addedTargets.Clear();
     _removedTargets.Clear();
     _targets        = null;
     _addedTargets   = null;
     _removedTargets = null;
 }
コード例 #29
0
    public void SetCreature(SplicedCreature splicedCreature)
    {
        oldCreature         = splicedCreature;
        head.sprite         = splicedCreature.head.head;
        jaw.sprite          = splicedCreature.jaw.jaw;
        body.sprite         = splicedCreature.body.body;
        tail.sprite         = splicedCreature.tail.tail;
        frontLegsR.sprite   = splicedCreature.frontLegs.frontLegsR;
        frontLegsL.sprite   = splicedCreature.frontLegs.frontLegsL;
        backLegsR.sprite    = splicedCreature.backLegs.backLegsR;
        backLegsL.sprite    = splicedCreature.backLegs.backLegsL;
        creatureObjectSetup = splicedCreature.body;
        LoadCreatureObjectPivots();
        LoadCreatureObjectColliders(splicedCreature);
        jaw.transform.localPosition = splicedCreature.head.jawPivot;
        body.transform.localScale   = new Vector3(splicedCreature.body.uniformScale, splicedCreature.body.uniformScale, splicedCreature.body.uniformScale);

        creatureDamage = splicedCreature.head.damage +
                         splicedCreature.jaw.damage +
                         splicedCreature.body.damage +
                         splicedCreature.tail.damage +
                         splicedCreature.frontLegs.damage +
                         splicedCreature.frontLegs.damage +
                         splicedCreature.backLegs.damage +
                         splicedCreature.backLegs.damage +
                         splicedCreature.body.damage;

        creatureHealth = splicedCreature.head.health +
                         splicedCreature.jaw.health +
                         splicedCreature.body.health +
                         splicedCreature.tail.health +
                         splicedCreature.frontLegs.health +
                         splicedCreature.frontLegs.health +
                         splicedCreature.backLegs.health +
                         splicedCreature.backLegs.health +
                         splicedCreature.body.health;

        maxCreatureHealth    = creatureHealth;
        healthBar.fillAmount = creatureHealth / maxCreatureHealth;
    }
コード例 #30
0
        public void itemDropedInInventory(CreatureObject _InventoryOwner, ItemObject _ItemObject, int _NewPosition)
        {
            if (this.items.Contains(_ItemObject))
            {
                this.changeItemPosition(_InventoryOwner, _ItemObject, _NewPosition);
            }
            else
            {
                //TODO: Kommt wohl von wo anders... anderes Inventar usw..
                //this.addItemObjectToInventory(_ItemObject);

                /*if (_InventoryOwner.Equipment.Contains(_ItemObject))
                 * {
                 *  //Sende jeweilige Änderung
                 *  if (Configuration.Configuration.isHost)
                 *  {
                 *
                 *  }
                 *  else
                 *  {
                 *      Event.EventList.Add(new Event(new GameLibrary.Connection.Message.CreatureEquipmentToInventoryMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, _NewPosition), GameMessageImportance.VeryImportant));
                 *  }
                 *  //_InventoryOwner.Equipment.Remove((EquipmentObject)_ItemObject);
                 *  //this.addItemObjectToInventory(_ItemObject);
                 * }*/
                if (_ItemObject is EquipmentObject)
                {
                    if (_InventoryOwner.Body.containsEquipmentObject((EquipmentObject)_ItemObject))
                    {
                        Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureEquipmentToInventoryMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, _NewPosition), GameMessageImportance.VeryImportant);
                    }
                    else
                    {
                        //_InventoryOwner enthält das Equip nicht im Body. Kommt woanders her!
                    }
                }
            }
        }
コード例 #31
0
ファイル: Inventory.cs プロジェクト: Gothen111/2DWorld
        //Sendet Änderung zum clienten bzw. server.
        public void changeItemPosition(CreatureObject _InventoryOwner, ItemObject _ItemObject, int _NewPosition)
        {
            int var_OldPosition = _ItemObject.PositionInInventory;
            _ItemObject.PositionInInventory = _NewPosition;
            if (var_OldPosition == _NewPosition)
            {

            }
            else
            {
                //Sende jeweilige Änderung
                if (Configuration.Configuration.isHost)
                {

                }
                else
                {
                    Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureInventoryItemPositionChangeMessage(_InventoryOwner.Id, var_OldPosition, _NewPosition), GameMessageImportance.VeryImportant);
                }
            }
        }
コード例 #32
0
ファイル: Inventory.cs プロジェクト: Gothen111/2DWorld
        //Dient nur zum wechseln! Ohne Senden! EHER für host
        public void changeItemPosition(CreatureObject _InventoryOwner, int _OldPosition, int _NewPosition)
        {
            ItemObject var_ItemToChange = null;

            foreach (ItemObject var_ItemObject in this.items)
            {
                if (var_ItemObject.PositionInInventory == _OldPosition)
                {
                    var_ItemToChange = var_ItemObject;
                    break;
                }
            }

            if (var_ItemToChange != null)
            {
                if (_NewPosition == -1)
                {
                    this.items.Remove(var_ItemToChange);
                    var_ItemToChange.PositionInInventory = _NewPosition;
                    var_ItemToChange.Position = new Microsoft.Xna.Framework.Vector3(40, 40, 0) + _InventoryOwner.Position;
                    GameLibrary.Model.Map.World.World.world.addObject(var_ItemToChange);
                }
                else
                {
                    //TODO: Gucke ob an __NewPosition kein objekt!
                    var_ItemToChange.PositionInInventory = _NewPosition;
                }
            }
        }
コード例 #33
0
ファイル: Inventory.cs プロジェクト: Gothen111/2DWorld
 public void dropItem(CreatureObject _InventoryOwner, ItemObject _ItemObject)
 {
     this.items.Remove(_ItemObject);
     this.InventoryChanged = true;
     if (Configuration.Configuration.isHost)
     {
     }
     else
     {
         Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureInventoryItemPositionChangeMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, -1), GameMessageImportance.VeryImportant);
     }
 }
コード例 #34
0
ファイル: Inventory.cs プロジェクト: Gothen111/2DWorld
        public void itemDropedInInventory(CreatureObject _InventoryOwner, ItemObject _ItemObject, int _NewPosition)
        {
            if (this.items.Contains(_ItemObject))
            {
                this.changeItemPosition(_InventoryOwner, _ItemObject, _NewPosition);
            }
            else
            {
                //TODO: Kommt wohl von wo anders... anderes Inventar usw..
                //this.addItemObjectToInventory(_ItemObject);
                /*if (_InventoryOwner.Equipment.Contains(_ItemObject))
                {
                    //Sende jeweilige Änderung
                    if (Configuration.Configuration.isHost)
                    {

                    }
                    else
                    {
                        Event.EventList.Add(new Event(new GameLibrary.Connection.Message.CreatureEquipmentToInventoryMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, _NewPosition), GameMessageImportance.VeryImportant));
                    }
                    //_InventoryOwner.Equipment.Remove((EquipmentObject)_ItemObject);
                    //this.addItemObjectToInventory(_ItemObject);
                }*/
                if (_ItemObject is EquipmentObject)
                {
                    if (_InventoryOwner.Body.containsEquipmentObject((EquipmentObject)_ItemObject))
                    {
                        Configuration.Configuration.networkManager.addEvent(new GameLibrary.Connection.Message.CreatureEquipmentToInventoryMessage(_InventoryOwner.Id, _ItemObject.PositionInInventory, _NewPosition), GameMessageImportance.VeryImportant);
                    }
                    else
                    {
                        //_InventoryOwner enthält das Equip nicht im Body. Kommt woanders her!
                    }
                }
            }
        }