Exemple #1
0
        public static Item Create(Player owner, Player formerPlayer, ItemSource itemSource, CreateItem cmd)
        {
            var newItem = new Item
            {
                Owner               = owner,
                FormerPlayer        = formerPlayer,
                ItemSource          = itemSource,
                dbLocationName      = cmd.dbLocationName,
                IsEquipped          = cmd.IsEquipped,
                TurnsUntilUse       = cmd.TurnsUntilUse,
                Level               = cmd.Level,
                TimeDropped         = cmd.TimeDropped,
                EquippedThisTurn    = cmd.EquippedThisTurn,
                PvPEnabled          = cmd.PvPEnabled,
                IsPermanent         = cmd.IsPermanent,
                LastSouledTimestamp = cmd.LastSouledTimestamp,
                LastSold            = cmd.LastSold
            };

            if (owner != null && owner.BotId != AIStatics.ActivePlayerBotId)
            {
                newItem.LastSouledTimestamp = DateTime.UtcNow.AddYears(-1);
            }

            return(newItem);
        }
Exemple #2
0
        public static Item CreateFromPlayer(Player formerPlayer, ItemSource itemSource, Player attacker, bool activePlayer)
        {
            var newItem = new Item
            {
                FormerPlayer     = formerPlayer,
                ItemSource       = itemSource,
                IsEquipped       = false,
                TurnsUntilUse    = 0,
                Level            = formerPlayer.Level,
                TimeDropped      = DateTime.UtcNow,
                EquippedThisTurn = false,

                LastSold = DateTime.UtcNow
            };

            if (formerPlayer.BotId == AIStatics.ActivePlayerBotId || activePlayer)
            {
                newItem.IsPermanent           = false;
                newItem.LastSouledTimestamp   = DateTime.UtcNow;
                newItem.ConsentsToSoulbinding = false;
                newItem.SetGameMode(attacker);
            }
            else
            {
                newItem.IsPermanent           = true;
                newItem.LastSouledTimestamp   = DateTime.UtcNow.AddYears(-1);
                newItem.PvPEnabled            = (int)GameModeStatics.GameModes.Any;
                newItem.ConsentsToSoulbinding = true;
            }

            return(newItem);
        }
Exemple #3
0
 /// <summary>
 /// Creates a consumable type item
 /// </summary>
 /// <param name="owner">Owner of the item</param>
 /// <param name="itemSource">ItemSource of the item</param>
 /// <returns>newly created item</returns>
 public static Item Create(Player owner, ItemSource itemSource)
 {
     return(new Item
     {
         Owner = owner,
         dbLocationName = "",
         IsPermanent = itemSource.IsPermanentFromCreation(),
         ItemSource = itemSource,
         PvPEnabled = (int)GameModeStatics.GameModes.Any,
         TimeDropped = DateTime.UtcNow,
         LastSouledTimestamp = DateTime.UtcNow.AddYears(-1),
         LastSold = DateTime.UtcNow
     });
 }