Exemplo n.º 1
0
 public void SetSources(FormSource formSource, EffectSource givesEffectSource, FormSource exclusiveToFormSource, ItemSource exlusiveToItemSource)
 {
     this.FormSource            = formSource;
     this.GivesEffectSource     = givesEffectSource;
     this.ExclusiveToFormSource = exclusiveToFormSource;
     this.ExclusiveToItemSource = exlusiveToItemSource;
 }
Exemplo n.º 2
0
        public void Init()
        {
            user = new UserBuilder().With(u => u.Id, "guid")
                   .With(u => u.Donator, new DonatorBuilder()
                         .With(d => d.Tier, 2)
                         .BuildAndSave())
                   .BuildAndSave();

            formSource = new FormSourceBuilder()
                         .With(f => f.Id, 100)
                         .With(f => f.FriendlyName, "Some Form")
                         .BuildAndSave();

            cmd = new CreatePlayer
            {
                FirstName    = "Bob",
                LastName     = "McBobbinson",
                UserId       = user.Id,
                Health       = 100,
                MaxHealth    = 100,
                Location     = "now here is nowhere",
                Gender       = PvPStatics.GenderMale,
                FormSourceId = formSource.Id
            };
        }
Exemplo n.º 3
0
        public static TFEnergy Create(Player player, Player caster, FormSource form, CreateTFEnergy cmd)
        {
            var newEnergy = new TFEnergy
            {
                Owner      = player,
                Caster     = caster,
                FormSource = form,
                Amount     = cmd.Amount,
                Timestamp  = DateTime.UtcNow
            };

            return(newEnergy);
        }
Exemplo n.º 4
0
 public static Player Create(User user, NPC npc, FormSource form, CreatePlayer cmd, Covenant covenant)
 {
     return(new Player
     {
         User = user,
         FirstName = cmd.FirstName,
         LastName = cmd.LastName,
         OriginalFirstName = cmd.FirstName,
         OriginalLastName = cmd.LastName,
         Location = cmd.Location,
         //Form = cmd.Form,
         FormSource = form,
         Health = cmd.Health,
         MaxHealth = cmd.MaxHealth,
         Mana = cmd.Mana,
         MaxMana = cmd.MaxMana,
         Level = cmd.Level,
         XP = cmd.XP,
         TimesAttackingThisUpdate = cmd.TimesAttackingThisUpdate,
         ActionPoints = cmd.ActionPoints,
         ActionPoints_Refill = cmd.ActionPoints_Refill,
         Gender = cmd.Gender,
         Mobility = cmd.Mobility,
         BotId = cmd.BotId,
         NPC = npc,
         MindControlIsActive = cmd.MindControlIsActive,
         IpAddress = cmd.IpAddress,
         LastActionTimestamp = cmd.LastActionTimestamp,
         LastCombatTimestamp = cmd.LastCombatTimestamp,
         LastCombatAttackedTimestamp = cmd.LastCombatAttackedTimestamp,
         FlaggedForAbuse = cmd.FlaggedForAbuse,
         UnusedLevelUpPerks = cmd.UnusedLevelUpPerks,
         GameMode = cmd.GameMode,
         InRP = cmd.InRP,
         CleansesMeditatesThisRound = cmd.CleansesMeditatesThisRound,
         Money = cmd.Money,
         Covenant = covenant,
         OriginalFormSource = form,
         PvPScore = cmd.PvPScore,
         DonatorLevel = cmd.DonatorLevel,
         Nickname = cmd.Nickname,
         OnlineActivityTimestamp = cmd.OnlineActivityTimestamp,
         IsBannedFromGlobalChat = cmd.IsBannedFromGlobalChat,
         ChatColor = cmd.ChatColor,
         ShoutsRemaining = cmd.ShoutsRemaining,
         InDuel = cmd.InDuel,
         InQuest = cmd.InQuest,
         InQuestState = cmd.InQuestState,
         ItemsUsedThisTurn = cmd.ItemsUsedThisTurn
     });
 }
Exemplo n.º 5
0
        public override void SetUp()
        {
            base.SetUp();

            newFormSource = new FormSourceBuilder()
                            .With(n => n.Id, 3)
                            .With(p => p.FriendlyName, "werewolf")
                            .With(p => p.Gender, PvPStatics.GenderFemale)
                            .BuildAndSave();

            oldFormSource = new FormSourceBuilder()
                            .With(n => n.Id, 1)
                            .BuildAndSave();
        }
        public override void SetUp()
        {
            base.SetUp();

            victimItems   = new List <Item>();
            emptyItemList = new List <Item>();

            var victimItem = new ItemBuilder()
                             .With(i => i.Id, 82624)
                             .With(i => i.dbLocationName, String.Empty)
                             .With(i => i.FormerPlayer, null)
                             .With(i => i.Owner, null)
                             .BuildAndSave();

            victimItems.Add(victimItem);

            victim = new PlayerBuilder()
                     .With(p => p.Id, 1)
                     .With(p => p.FirstName, "Victim")
                     .With(p => p.LastName, "MgGee")
                     .With(p => p.GameMode, (int)GameModeStatics.GameModes.PvP)
                     .With(p => p.BotId, AIStatics.ActivePlayerBotId)
                     .With(p => p.Level, 13)
                     .With(p => p.Location, "someplace")
                     .With(p => p.Items, victimItems)
                     .BuildAndSave();

            attacker = new PlayerBuilder()
                       .With(p => p.Id, 2)
                       .With(p => p.FirstName, "Attacker")
                       .With(p => p.LastName, "Smacker")
                       .With(p => p.Items, emptyItemList)
                       .With(p => p.GameMode, (int)GameModeStatics.GameModes.Superprotection)
                       .BuildAndSave();

            itemSource = new ItemSourceBuilder()
                         .With(i => i.Id, 100)
                         .With(i => i.FriendlyName, "A new Item!")
                         .With(i => i.ItemType, PvPStatics.ItemType_Pants)
                         .BuildAndSave();

            formSource = new FormSourceBuilder()
                         .With(i => i.Id, 87)
                         .With(i => i.MobilityType, PvPStatics.MobilityInanimate)
                         .With(i => i.ItemSource, itemSource)
                         .BuildAndSave();
        }
Exemplo n.º 7
0
        public void Init()
        {
            skill = new SkillSourceBuilder()
                    .With(ss => ss.Id, 55)
                    .BuildAndSave();

            form = new FormSourceBuilder()
                   .With(f => f.Id, 3)
                   .BuildAndSave();

            exclusiveToForm = new FormSourceBuilder()
                              .With(f => f.Id, 7)
                              .BuildAndSave();

            exlusiveToItem = new ItemSourceBuilder()
                             .With(i => i.Id, 100)
                             .BuildAndSave();

            givesEffect = new EffectSourceBuilder()
                          .With(i => i.Id, 78)
                          .BuildAndSave();
        }
Exemplo n.º 8
0
        public LogBox TurnIntoItem(Player attacker, FormSource formSource, ItemSource itemSource, bool dropItems, bool activePlayer)
        {
            var logbox = new LogBox();

            this.FormSource = formSource;
            this.Mobility   = formSource.MobilityType;

            var newItem = Item.CreateFromPlayer(this, itemSource, attacker, activePlayer);

            this.Item = newItem;

            if (dropItems)
            {
                this.DropAllItems();
            }

            if (attacker == null)
            {
                newItem.SetLocation(this.Location);
            }
            else
            {
                if (attacker.Id != this.Id && attacker.HasRoomForNewItem(newItem))
                {
                    attacker.GiveItem(newItem);
                    newItem.ChangeOwner(attacker);
                }
                else
                {
                    newItem.SetLocation(this.Location);
                }
            }

            logbox.AttackerLog = $"<br><b>You fully transformed {this.GetFullName()} into a {itemSource.FriendlyName}</b>!";
            logbox.VictimLog   = $"<br><b>You have been fully transformed into a {itemSource.FriendlyName}!</b>!";
            logbox.LocationLog = $"<br><b>{this.GetFullName()} was completely transformed into a {itemSource.FriendlyName}</b> here.";

            return(logbox);
        }
Exemplo n.º 9
0
        public override int Execute(IDataContext context)
        {
            var result = 0;

            ContextQuery = ctx =>
            {
                var player = ctx.AsQueryable <Player>().SingleOrDefault(p => p.Id == PlayerId);

                if (player == null)
                {
                    throw new DomainException($"Player with ID {PlayerId} could not be found");
                }

                Player caster = null;

                FormSource form = null;

                caster = ctx.AsQueryable <Player>().SingleOrDefault(p => p.Id == CasterId);

                if (FormSourceId != null)
                {
                    form = ctx.AsQueryable <FormSource>().SingleOrDefault(t => t.Id == FormSourceId);
                }

                var energy = Entities.TFEnergy.Create(player, caster, form, this);

                ctx.Add(energy);
                ctx.Commit();

                result = energy.Id;
            };

            ExecuteInternal(context);

            return(result);
        }
Exemplo n.º 10
0
        public void Init()
        {
            originalForm = new FormSourceBuilder()
                           .With(n => n.Id, 1)
                           .With(n => n.FriendlyName, "Base Form")
                           .With(n => n.Gender, PvPStatics.GenderFemale)
                           .BuildAndSave();

            currentForm = new FormSourceBuilder()
                          .With(n => n.Id, 2)
                          .With(n => n.FriendlyName, "Current Form")
                          .With(n => n.Gender, PvPStatics.GenderMale)
                          .BuildAndSave();

            player = new PlayerBuilder()
                     .With(p => p.Id, 23)
                     .With(p => p.FormSource, currentForm)
                     .With(p => p.OriginalFormSource, originalForm)
                     .With(p => p.ActionPoints, 50)
                     .With(p => p.Mana, 25)
                     .BuildAndSave();

            buffs = new BuffBox();
        }
Exemplo n.º 11
0
        public void ChangeForm(FormSource form)
        {
            if (this.Item != null)
            {
                if (this.Item.Owner != null && !this.Item.Owner.Location.IsNullOrEmpty())
                {
                    this.Location = this.Item.Owner.Location;
                }
                else if (!this.Item.dbLocationName.IsNullOrEmpty())
                {
                    this.Location = this.Item.dbLocationName;
                }
            }

            if (this.Location.IsNullOrEmpty())
            {
                this.Location = LocationsStatics.GetRandomLocationNotInDungeonOr(LocationsStatics.JOKE_SHOP);
            }

            FormSource = form;
            Gender     = form.Gender;
            Mobility   = form.MobilityType;
            ForceWithinBounds();
        }
Exemplo n.º 12
0
        public override void Execute(IDataContext context)
        {
            ContextQuery = ctx =>
            {
                var skillSource = ctx.AsQueryable <SkillSource>().SingleOrDefault(t => t.Id == SkillSourceId);
                if (skillSource == null)
                {
                    throw new DomainException($"StaticSkill Source with Id {SkillSourceId} could not be found");
                }

                FormSource   formSource            = null;
                EffectSource givesEffectSource     = null;
                FormSource   exclusiveToFormSource = null;
                ItemSource   exclusiveToItemSource = null;

                if (FormSourceId != null || FormSourceId > 0)
                {
                    formSource = ctx.AsQueryable <FormSource>().SingleOrDefault(t => t.Id == FormSourceId);
                    if (formSource == null)
                    {
                        throw new DomainException(
                                  $"FormSource Source with id '{FormSourceId}' could not be found.  Does it need to be published first?");
                    }
                }

                if (GivesEffectSourceId != null)
                {
                    givesEffectSource = ctx.AsQueryable <EffectSource>().SingleOrDefault(t => t.Id == GivesEffectSourceId);
                    if (givesEffectSource == null)
                    {
                        throw new DomainException($"EffectSource with Id '{GivesEffectSourceId}' could not be found");
                    }
                }

                if (ExclusiveToFormSourceId != null && ExclusiveToFormSourceId.Value > 0)
                {
                    exclusiveToFormSource = ctx.AsQueryable <FormSource>().SingleOrDefault(t => t.Id == ExclusiveToFormSourceId);
                    if (exclusiveToFormSource == null)
                    {
                        throw new DomainException(
                                  $"ExclusiveToFormSourceId with id '{ExclusiveToFormSourceId}' could not be found");
                    }
                }

                if (ExclusiveToItemSourceId != null)
                {
                    exclusiveToItemSource = ctx.AsQueryable <ItemSource>().SingleOrDefault(t => t.Id == ExclusiveToItemSourceId);
                    if (exclusiveToFormSource == null)
                    {
                        throw new DomainException(
                                  $"ExclusiveToItemSource with id '{ExclusiveToItemSourceId}' could not be found");
                    }
                }

                skillSource.SetSources(formSource, givesEffectSource, exclusiveToFormSource, exclusiveToItemSource);

                ctx.Update(skillSource);
                ctx.Commit();
            };

            ExecuteInternal(context);
        }