public static void SpawnLindella()
        {
            var merchant = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.LindellaBotId
            });

            if (merchant == null)
            {
                var cmd = new CreatePlayer
                {
                    BotId        = AIStatics.LindellaBotId,
                    Level        = 5,
                    FirstName    = "Lindella",
                    LastName     = "the Soul Vendor",
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    Mobility     = PvPStatics.MobilityFull,
                    Money        = 1000,
                    FormSourceId = LindellaFormId,
                    Location     = "270_west_9th_ave", // Lindella starts her rounds here
                    Gender       = PvPStatics.GenderFemale,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                IPlayerRepository playerRepo = new EFPlayerRepository();
                var newMerchant = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                newMerchant.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(newMerchant));
                playerRepo.SavePlayer(newMerchant);

                AIDirectiveProcedures.GetAIDirective(id);
                AIDirectiveProcedures.SetAIDirective_MoveTo(id, "street_15th_south");
            }
        }
Example #2
0
        public Player(CreatePlayer cmd)
        {
            Id        = cmd.LahmanId;
            PlayerId  = cmd.PlayerId;
            FirstName = cmd.FirstName;
            LastName  = cmd.LastName;
            NickName  = cmd.NickName;
            College   = cmd.College;
            Bats      = cmd.Bats;
            Throws    = cmd.Throws;
            Height    = cmd.Height;
            Weight    = cmd.Weight;
            Debut     = cmd.Debut;
            FinalGame = cmd.FinalGame;
            Years     = new List <PlayerYear>();

            var repo = new CardRepository("mongodb://localhost:27017");

            repo.Save(this);

            ApplyEvent(new PlayerCreated()
            {
                FullName = String.Format("{0} {1}", FirstName, LastName),
                PlayerId = PlayerId
            });
        }
Example #3
0
        public static void SpawnLoremaster()
        {
            var loremaster = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.LoremasterBotId
            });

            if (loremaster == null)
            {
                var cmd = new CreatePlayer
                {
                    BotId        = AIStatics.LoremasterBotId,
                    Level        = 5,
                    FirstName    = FirstName,
                    LastName     = LastName,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    Mobility     = PvPStatics.MobilityFull,
                    Money        = 1000,
                    FormSourceId = LoremasterFormId,
                    Location     = "bookstore_back",
                    Gender       = PvPStatics.GenderMale,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo   = new EFPlayerRepository();
                var lorekeeperEF = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                lorekeeperEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(lorekeeperEF));
                playerRepo.SavePlayer(lorekeeperEF);
            }
        }
Example #4
0
    IEnumerator CouPreloadModel()
    {
        while (ConfigMng.Instance.Pendings > 0)
        {
            yield return(new WaitForFixedUpdate());
        }
        if (GameCenter.loginMng.createPlayerInfoDic.Count == 0)
        {
            GameCenter.loginMng.InitCreatePlayerInfo();
            foreach (PlayerBaseInfo item in GameCenter.loginMng.createPlayerInfoDic.Values)
            {
                CreatePlayer preloadPlayer = CreatePlayer.CreateDummy(item);
                preloadPlayer.StartAsyncCreate(() =>
                {
                    preloadPlayer.transform.position = new Vector3(-1000, -1000, -1000);
                });

                AbilityInstance ability = new AbilityInstance(item.CreateAbilityID, 1, null, null);
                if (ability != null)
                {
                    string effectName = ability.ProcessEffectList.Count > 0 ? ability.ProcessEffectList[0] : string.Empty;
                    if (!string.IsNullOrEmpty(effectName))
                    {
                        AssetMng.GetEeffctAssetObject(effectName, (x) => { });
                        //AssetMng.GetEffectInstance(effectName, null);//预加载特效
                    }
                }
            }
        }
    }
Example #5
0
    /// <summary>
    /// 创建净数据对象
    /// </summary>
    /// <param name="_id"></param>
    /// <returns></returns>
    public static CreatePlayer CreateDummy(PlayerBaseInfo _info)
    {
        GameObject newGO = null;

        if (GameCenter.instance.dummyOpcPrefab != null)
        {
            newGO      = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject;
            newGO.name = "Dummy CPC [" + _info.ServerInstanceID + "]";
        }
        else
        {
            newGO = new GameObject("Dummy CPC[" + _info.ServerInstanceID + "]");
        }
        newGO.tag = "Player";
        newGO.SetMaskLayer(LayerMask.NameToLayer("Player"));
        CreatePlayer newOPC = newGO.AddComponent <CreatePlayer>();

        newOPC.isDummy_ = true;
        // newOPC.moveFSM = newGO.AddComponent<ActorMoveFSM>();
        newOPC.id        = _info.ServerInstanceID;
        newOPC.actorInfo = _info;
        //   newOPC.curMoveSpeed = newOPC.actorInfo.StaticSpeed * MOVE_SPEED_BASE;
        //  newOPC.CurRealSpeed = newOPC.curMoveSpeed;
        //  newOPC.RegistMoveEvent(true);
        newOPC.transform.localRotation = new Quaternion(0, _info.RotationY, 0, 0);
        GameCenter.curGameStage.PlaceGameObjectFromServer(newOPC, _info.ServerPos.x, _info.ServerPos.z, (int)newOPC.transform.localEulerAngles.y);
        GameCenter.curGameStage.AddObject(newOPC);
        return(newOPC);
    }
        public static CreatePlayer read(BinaryReader binaryReader)
        {
            CreatePlayer newObj = new CreatePlayer();

            newObj.object_id = binaryReader.ReadUInt32();
            return(newObj);
        }
        public static void SpawnBartender()
        {
            var bartender = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.DonnaBotId
            });

            if (bartender == null)
            {
                var cmd = new CreatePlayer
                {
                    FirstName    = "Rusty",
                    LastName     = "Steamstein the Automaton Bartender",
                    Location     = "tavern_counter",
                    Gender       = PvPStatics.GenderMale,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    FormSourceId = BartenderFormId,
                    Money        = 0,
                    Mobility     = PvPStatics.MobilityFull,
                    Level        = 15,
                    BotId        = AIStatics.BartenderBotId,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                IPlayerRepository playerRepo = new EFPlayerRepository();
                var newBartender             = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                newBartender.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(newBartender));
                playerRepo.SavePlayer(newBartender);
            }
        }
        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
            };
        }
Example #9
0
    //int taskCount
    // Use this for initialization
    void Start()
    {
        createPlayer = Camera.main.GetComponent<CreatePlayer>();

        string dbPath = Application.persistentDataPath + "/recordtask.db";
        //Debug.Log(dbPath);
        recordTask = new DbAccess("URI=file:" + dbPath);
        tableInfo = new string[] { "taskid", "userid", "time", "AttackResult", "reward1", "reward2", "reward3" };
        recordTask.CreateTable("task", tableInfo, new string[] { "INTEGER PRIMARY KEY", "text", "text", "BOOLEAN", "INTRGER", "INTRGER", "INTRGER" });
        date = System.DateTime.Now;
        //Debug.Log(date);
        recordTask.InsertInto("task", tableInfo, new ArrayList { "userid", date.ToString(), true, 10, 11, 12 },  1, 0);

        operationInfo = new string[] { "operationId", "taskid", "time", "locationx", "locationy", "locationz", "operationType", "operationObject", "FOREIGN KEY(taskid) REFERENCES " };
        recordTask.CreateTable("operation", operationInfo, new string[] { "INTEGER PRIMARY KEY", "INTRGER", "FLOAT", "FLOAT", "FLOAT", "FLOAT", "TEXT","TEXT", "task(taskid)" });
        using (SqliteDataReader sqReader = recordTask.ReadFullTable("task"))
        {

            while (sqReader.Read())
            {
                taskid_task = sqReader.GetInt32(sqReader.GetOrdinal("taskid"));
              //  Debug.Log(taskid_task);
            }
            sqReader.Close();
        }
    }
Example #10
0
    public void SetCurPlayer(PlayerBaseInfo _info)
    {
        if (originalPosition != Vector3.zero && camera != null)
        {
            camera.transform.localPosition = originalPosition;
        }

        if (curCreatePlayer != null)
        {
            DestroyImmediate(curCreatePlayer.gameObject);
            curCreatePlayer = null;
        }
        if (_info == null)
        {
            return;
        }
        if (dragRotation != null)
        {
            dragRotation.SetObjRotY(180);
            dragRotation.SetEnable(false);//震动中不让拖动旋转,否则相机位置会偏差很大
        }
        curCreatePlayer = CreatePlayer.CreateDummy(_info);
        curCreatePlayer.transform.position = positionTransform.position;
        curCreatePlayer.StartAsyncCreate(() =>
        {
            AbilityInstance ability = new AbilityInstance(_info.CreateAbilityID, 1, curCreatePlayer, null);
            curCreatePlayer.UseAbility(ability, () =>
            {
                ShakeCamera(ability.ProcessShakeV3, (ability.ProcessShakePowerList.Count > 0 ? ability.ProcessShakePowerList[0] : 0.2f));
            }, FinishAbility);
        });
    }
Example #11
0
    void SpawnPlayer(CreatePlayer createPlayer)
    {
        GameObject container = Instantiate(new GameObject());

        container.name             = "Player";
        container.transform.parent = snakesContainer;
        var head = Instantiate(playerHead, container.transform);

        head.name = "PlayerHead";
        SnakeHead snakeHeadManager = head.GetComponent <SnakeHead>();

        snakeHeadManager.playerColor = createPlayer.color;
        snakeHeadManager.name        = createPlayer.name;

        head.GetComponent <TrailRenderer>().colorGradient = GetGradient(snakeHeadManager.playerColor);
        head.GetComponent <SpriteRenderer>().color        = snakeHeadManager.playerColor;



        head.transform.position = createPlayer.pos;
        head.transform.up       = createPlayer.der;

        for (int i = 0; i < GlobalConsts.DEFAULT_LENGTH - 1; i++)
        {
            GameObject newSegment = Instantiate(bodySegment, container.transform);
            newSegment.AddComponent(typeof(SegmentCollision));
            newSegment.GetComponent <TrailRenderer>().colorGradient = GetGradient(snakeHeadManager.playerColor);
            var newColor = snakeHeadManager.playerColor;
            newColor.a = GlobalConsts.SEGMENT_TRANSPARINCY;
            newSegment.GetComponent <SpriteRenderer>().color = newColor;
            snakeHeadManager.segments.Add(newSegment);
        }

        playerHeadTranform = head.transform;
    }
        public static void SpawnPetMerchant()
        {
            var petMerchant = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.WuffieBotId
            });

            if (petMerchant == null)
            {
                var cmd = new CreatePlayer
                {
                    BotId        = AIStatics.WuffieBotId,
                    Level        = 5,
                    FirstName    = "Wüffie",
                    LastName     = "the Soul Pet Vendor",
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    Mobility     = PvPStatics.MobilityFull,
                    Money        = 1000,
                    FormSourceId = WuffieFormId,
                    Location     = "270_west_9th_ave", // Lindella starts her rounds here
                    Gender       = PvPStatics.GenderFemale,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo    = new EFPlayerRepository();
                var petMerchantEF = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                petMerchantEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(petMerchantEF));
                playerRepo.SavePlayer(petMerchantEF);
            }
        }
Example #13
0
 private void CreatePlayers_Click(object sender, RoutedEventArgs e)
 {
     CreatePlayer cp = new CreatePlayer()
     {
         Visibility = Visibility.Visible,
         IsEnabled  = true
     };
 }
        // Batch Create Player
        public List<HttpResult> Post(CreatePlayer[] requests)
        {
            using (var trans = Db.OpenTransaction())
            {
                var responses = requests.Map(Post);

                trans.Commit();
                return responses;
            }
        }
Example #15
0
        public static void SpawnBimboBoss()
        {
            var bimboBoss = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.BimboBossBotId
            });

            if (bimboBoss == null)
            {
                var cmd = new CreatePlayer
                {
                    FirstName    = BossFirstName,
                    LastName     = BossLastName,
                    Location     = "stripclub_bar_seats",
                    Gender       = PvPStatics.GenderFemale,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    FormSourceId = BimboBossFormSourceId,
                    Money        = 2500,
                    Level        = 15,
                    BotId        = AIStatics.BimboBossBotId,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo = new EFPlayerRepository();
                var bimboEF    = playerRepo.Players.FirstOrDefault(p => p.Id == id);

                bimboEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(bimboEF));

                playerRepo.SavePlayer(bimboEF);


                // set up her AI directive so it is not deleted
                IAIDirectiveRepository aiRepo = new EFAIDirectiveRepository();
                var directive = new AIDirective
                {
                    OwnerId        = id,
                    Timestamp      = DateTime.UtcNow,
                    SpawnTurn      = PvPWorldStatProcedures.GetWorldTurnNumber(),
                    DoNotRecycleMe = true,
                };

                aiRepo.SaveAIDirective(directive);

                for (var i = 0; i < 2; i++)
                {
                    DomainRegistry.Repository.Execute(new GiveRune {
                        ItemSourceId = RuneStatics.BIMBO_RUNE, PlayerId = bimboEF.Id
                    });
                }
            }
        }
        public void TestWrite()
        {
            var ms = new MapStart {
                MapSize = 1024
            };

            byte[] buffer = new byte[ms.Length];
            ms.Write(buffer.AsSpan());

            byte[] expected = new byte[] { 0x0, 0x4, 0x0, 0x0 };

            Assert.Equal(expected, buffer);

            var cp = new CreatePlayer
            {
                Name     = "Deuce",
                PlayerId = 0,
                Position = new Vector3(0f, 0f, 0f),
                Team     = TeamType.Blue,
                Weapon   = WeaponType.Rifle
            };

            buffer = new byte[cp.Length];
            cp.Write(buffer.AsSpan());

            expected = new byte[]
            {
                // ID
                0x0,

                // Weapon
                0x0,

                // Team
                (byte)TeamType.Blue,

                // Position
                0x0, 0x0, 0x0, 0x00,
                0x0, 0x0, 0x0, 0x00,
                0x0, 0x0, 0x0, 0x00,

                // Name
                0x44, 0x65, 0x75, 0x63, 0x65
            };

            output.WriteLine("Expected:");
            output.WriteLine(HexDump.Create(expected));
            output.WriteLine("Actual:");
            output.WriteLine(HexDump.Create(buffer));

            Assert.Equal(expected, buffer);
        }
 [HttpPost] /// <summary>This is where it posts upon submit </summary>
 public ActionResult Create(CreatePlayer cp)
 {
     if (this.ModelState.IsValid)
     {
         PlayerController pc = new PlayerController();
         pc.Post(cp);
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(View(cp));
     }
 }
Example #18
0
    public override void Quit()
    {
        CreatePlayer creator = GameObject.Find("PlayerCreator").GetComponent <CreatePlayer>();

        Debug.Log(creator);
        foreach (GameObject player in Players)
        {
            creator.holdStats(player.GetComponent <PlayerMover>().playerNum, player.GetComponent <StatTracker>());
            Destroy(player);
        }
        Destroy(c.gameObject);
        SceneManager.LoadScene(18);
    }
Example #19
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
     });
 }
        /// <summary>
        /// Creates a Player with specific information.
        /// </summary>
        public IHttpActionResult Post(CreatePlayer player)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var service = CreatePlayerService();

            if (!service.CreatePlayer(player))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Example #21
0
    IEnumerator CreateAsync(System.Action _callback = null)
    {
        if (isDummy_ == false)
        {
            Debug.LogError("You can only start create other player in dummy: " + actorInfo.ServerInstanceID);
            yield break;
        }
        //
        isDownloading_ = true;                          //判断是否正在下载,防止重复创建

        CreatePlayer       opc            = null;
        PlayerRendererCtrl myRendererCtrl = null;
        bool faild = false;

        pendingDownload = Create(actorInfo, delegate(CreatePlayer _opc, EResult _result)
        {
            if (_result != EResult.Success)
            {
                faild = true;
                return;
            }

            opc             = _opc;
            pendingDownload = null;
            myRendererCtrl  = opc.gameObject.GetComponentInChildrenFast <PlayerRendererCtrl>();
            myRendererCtrl.Show(false);
        });
        while (opc == null || opc.inited == false)
        {
            if (faild)
            {
                yield break;
            }
            yield return(null);
        }

        pendingDownload = null;
        isDownloading_  = false;

        if (!actorInfo.IsAlive)
        {
            opc.Dead(true);
        }
        if (_callback != null)
        {
            _callback();
        }
    }
 // Use this for initialization
 void Start()
 {
     rb                = GetComponent <Rigidbody2D>();
     selected          = null;
     aPressCooldown    = 0;
     yPressCooldown    = 0;
     bPressCooldown    = 0;
     creator           = GameObject.Find("PlayerCreator").GetComponent <CreatePlayer>();
     characterSelected = creator.active[playerNum];
     nameTag           = nameString.GetComponent <Text>();
     name              = creator.getName(playerNum);
     if (name != null)
     {
         nameTag.text = name;
     }
 }
Example #23
0
        public static Player Create(CreatePlayer command)
        {
            var player = new Player();

            player.ApplyEvent(
                new PlayerCreated(
                    command.PlayerId,
                    command.Name,
                    command.Password,
                    player.Version,
                    command.CommandId
                    )
                );

            return(player);
        }
        // Create Player
        public HttpResult Post(CreatePlayer request)
        {
            var player = request.ConvertTo<Player>();

            Db.Save(player);

            return
                new HttpResult(Get(new GetPlayer {Id = player.Id }))
                {
                    StatusCode = HttpStatusCode.Created,
                    Headers =
                    {
                        {HttpHeaders.Location, new GetPlayer {Id = player.Id}.ToGetUrl()}
                    }
                };
        }
        public static void SpawnFae()
        {
            var fae = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.JewdewfaeBotId
            });

            if (fae == null)
            {
                var cmd = new CreatePlayer
                {
                    FirstName    = FirstName,
                    LastName     = LastName,
                    Location     = "apartment_dog_park",
                    Gender       = PvPStatics.GenderFemale,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    FormSourceId = FaeFormId,
                    Money        = 1000,
                    Level        = 7,
                    BotId        = AIStatics.JewdewfaeBotId
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo = new EFPlayerRepository();
                var faeEF      = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                faeEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(faeEF));
                playerRepo.SavePlayer(faeEF);

                // set up her AI directive so it is not deleted
                IAIDirectiveRepository aiRepo = new EFAIDirectiveRepository();
                var directive = new AIDirective
                {
                    OwnerId        = id,
                    Timestamp      = DateTime.UtcNow,
                    SpawnTurn      = 0,
                    DoNotRecycleMe = true,
                    sVar1          = ";", // this is used to keep track of which players have interacted with her by appending their id to this string
                    sVar2          = "",  // this is used to keep track of which locations Jewdewfae has been in during the past cycle
                    Var1           = 0,   // this keeps track of how many people she has played with in the current location
                    Var2           = 0    // this stores the turn number of Jewdewfae's last move
                };

                aiRepo.SaveAIDirective(directive);
            }
        }
Example #26
0
        private void CreatePlayer(string name, EntityConfig node, SimulationLifecycleManager lifecycleManager, out ComponentEntityTuple <ITAlert.Simulation.Components.EntityTypes.Player> player)
        {
            var playerMatcher             = lifecycleManager.ECSRoot.ECS.MatcherProvider.CreateMatcherGroup <ITAlert.Simulation.Components.EntityTypes.Player>();
            var priorMatchingEntitesTotal = playerMatcher.MatchingEntities.Length;

            // Create a NPC to initiate the swap action
            var createNpc = new CreatePlayer(Player.Archetype,
                                             node,
                                             name);

            createNpc.Execute(lifecycleManager.ECSRoot.ECS,
                              lifecycleManager.ECSRoot.Configuration);

            // Tick so commands get processed
            lifecycleManager.ECSRoot.ECS.Tick();

            player = playerMatcher.MatchingEntities[priorMatchingEntitesTotal];
        }
    public void SignInSuccess(Dictionary <string, string> auth)
    {
        if (auth["isAble"] == "True")
        {
            SignInStatus.text = "Success";

            PlayerNetwork.Instance.isGuest = false;

            InputPlayerName.text = auth["mess"];

            CreatePlayer createPlayer = CPObj.GetComponent <CreatePlayer>();
            createPlayer.OnClick_CreatePlayer();
        }
        else
        {
            SignInStatus.text      = auth["mess"];
            SignInBtn.interactable = true;
        }
    }
Example #28
0
        public bool CreatePlayer(CreatePlayer model)
        {
            var entity = new Player()
            {
                TeamId               = model.TeamId,
                PlayerFirstName      = model.PlayerFirstName,
                PlayerLastName       = model.PlayerLastName,
                PlayerPosition       = model.PlayerPosition,
                PlayerJerseyNumber   = model.PlayerJerseyNumber,
                PlayerHeightByInches = model.PlayerHeightByInches,
                PlayerWeightByPounds = model.PlayerWeightByPounds
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Players.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Example #29
0
 // Use this for initialization
 void Start()
 {
     delay   = 30;
     Ready   = new bool[4];
     creator = GameObject.Find("PlayerCreator").GetComponent <CreatePlayer>();
     stats   = creator.getStats();
     for (int i = 0; i < 4; i++)
     {
         Ready[i] = false;
         if (stats[i] != null)
         {
             populateStats(i);
         }
         else
         {
             PlayerBox[i].SetActive(false);
             Ready[i] = true;
         }
     }
 }
Example #30
0
        private void OnCreatePlayer(CreatePlayer ev)
        {
            if (string.IsNullOrEmpty(ev.Username) || ev.Username.Length < 5 || !usernameRegex.IsMatch(ev.Username))
            {
                Reply(new CreatePlayerResponse("Username must be at least 5 characters and consist only of US characters"));
            }

            if (string.IsNullOrEmpty(ev.Password) || ev.Password.Length < 5 || !passwordRegex.IsMatch(ev.Password))
            {
                Reply(new CreatePlayerResponse("Username must be at least 5 characters and consist only of US characters and numbers"));
            }

            // May throw, as we are not in critical section it is ok
            if (State.UsernameToPlayer.TryGetValue(ev.Username, out Tuple <string, IReactorReference> result))
            {
                Reply(new CreatePlayerResponse("Username already exists"));
                return;
            }

            string handle = Guid.NewGuid().ToString();

            if (State.PlayersByHandle.TryGetValue(handle, out IReactorReference result2))
            {
                Reply(new CreatePlayerResponse("Player's handle already exists"));
                return;
            }

            EnterCriticalSection();

            // Need create player's reactor and add it to repo
            var playerReactor = new PlayerReactor(handle);

            Repository.Add(playerReactor);

            var reference = Repository.Resolve <PlayerReactor>(handle);

            State.UsernameToPlayer.Add(ev.Username, new Tuple <string, IReactorReference>(ev.Password, reference));
            State.PlayersByHandle.Add(handle, reference);

            Reply(new CreatePlayerResponse(reference));
        }
Example #31
0
        /// <summary>
        /// Spawns Narcissa into the world and sets her initial blank AI Directive
        /// </summary>
        public static void SpawnFaeBoss()
        {
            var faeboss = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId {
                BotId = AIStatics.FaebossBotId
            });

            if (faeboss == null)
            {
                var cmd = new CreatePlayer
                {
                    FirstName    = FirstName,
                    LastName     = LastName,
                    Location     = SpawnLocation,
                    Gender       = PvPStatics.GenderFemale,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    FormSourceId = FaeBossFormId,
                    Money        = 1000,
                    Mobility     = PvPStatics.MobilityFull,
                    Level        = 25,
                    BotId        = AIStatics.FaebossBotId,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo = new EFPlayerRepository();
                var faebossEF  = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                faebossEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(faebossEF));
                playerRepo.SavePlayer(faebossEF);

                AIDirectiveProcedures.GetAIDirective(id);

                for (var i = 0; i < 2; i++)
                {
                    DomainRegistry.Repository.Execute(new GiveRune {
                        ItemSourceId = RuneStatics.NARCISSA_RUNE, PlayerId = faebossEF.Id
                    });
                }
            }
        }
Example #32
0
    public static void NewGameInformation()
    {
        GameObject GameInformationObject = new GameObject("GameInformation"); //Creates a game object to keep track of all game information

        GameInformationObject.AddComponent <GameInformation>();               //Assigns the GameInformation.cs script to GameInformationObject

        //Creates instances of player objects in order to set up initial game
        BasePlayer Player1 = new BasePlayer()
        {
            PlayerClass = new BaseHeroClass()
        };
        BasePlayer Player2 = new BasePlayer()
        {
            PlayerClass = new BaseMusicianClass()
        };
        BasePlayer Player3 = new BasePlayer()
        {
            PlayerClass = new BaseAcademicClass()
        };
        BasePlayer Player4 = new BasePlayer()
        {
            PlayerClass = new BaseAthleteClass()
        };

        //Sets initial story progress and money
        GameInformation.StoryProgress = 0;
        GameInformation.Money         = 0;

        //Adds all players to the list of possible party members
        GameInformation.AddPlayer(Player1);
        GameInformation.AddPlayer(Player2);
        GameInformation.AddPlayer(Player3);
        GameInformation.AddPlayer(Player4);

        GameInformation.AddToParty(Player1);                //Adds the player character to the party
        GameInformation.AddToParty(Player2);                //Adds the player character to the party
        GameInformation.AddToParty(Player3);                //Adds the player character to the party
        GameInformation.AddToParty(Player4);                //Adds the player character to the party

        CreatePlayer.CreatePlayerObject(new Vector2(0, 0)); //Creates the player object in the centre of the world map
    }
Example #33
0
        public static void Spawn()
        {
            var boss = DomainRegistry.Repository.FindSingle(new GetPlayerByBotId
            {
                BotId = AIStatics.MotorcycleGangLeaderBotId
            });

            if (boss == null)
            {
                var cmd = new CreatePlayer
                {
                    FirstName    = BossFirstName,
                    LastName     = BossLastName,
                    Location     = SpawnLocation,
                    Gender       = PvPStatics.GenderFemale,
                    Health       = 100000,
                    Mana         = 100000,
                    MaxHealth    = 100000,
                    MaxMana      = 100000,
                    FormSourceId = BossFormId,
                    Money        = 2000,
                    Mobility     = PvPStatics.MobilityFull,
                    Level        = 20,
                    BotId        = AIStatics.MotorcycleGangLeaderBotId,
                };
                var id = DomainRegistry.Repository.Execute(cmd);

                var playerRepo = new EFPlayerRepository();
                var bossEF     = playerRepo.Players.FirstOrDefault(p => p.Id == id);
                bossEF.ReadjustMaxes(ItemProcedures.GetPlayerBuffs(bossEF));
                playerRepo.SavePlayer(bossEF);

                for (var i = 0; i < 2; i++)
                {
                    DomainRegistry.Repository.Execute(new GiveRune {
                        ItemSourceId = RuneStatics.MOTORCYCLE_RUNE, PlayerId = bossEF.Id
                    });
                }
            }
        }