示例#1
0
        public static void CreateCharacter(
            AsyncRPGDataContext context,
            int account_id,
            string name,
            GameConstants.eGender gender,
            GameConstants.eArchetype archetype,
            int picture_id)
        {
            Characters newCharacter = new Characters
            {
                AccountID= account_id,
                GameID= -1,
                RoomX = 0,
                RoomY = 0,
                RoomZ = 0,
                LastPingTime = DateTime.Now,
                LastSentEventID = -1,
                NewEventsPosted = false,
                X= 0.0f,
                Y= 0.0f,
                Z= 0.0f,
                Angle= 0.0f,
                Name= name,
                Gender = (gender == GameConstants.eGender.Male),
                Archetype = (int)archetype,
                PictureID = picture_id,
                PowerLevel= 1,
                Energy= 0
            };

            context.Characters.InsertOnSubmit(newCharacter);
            context.SubmitChanges();
        }
 public CharacterCreateRequestProcessor(
     int account_id,
     string name,
     GameConstants.eGender gender,
     GameConstants.eArchetype archetype,
     int picture_id)
 {
     m_account_id = account_id;
     m_name = name;
     m_gender = gender;
     m_archetype = archetype;
     m_picture_id = picture_id;
 }
        public static void UpdateEnergyTankOwnership(
            AsyncRPGDataContext db_context,
            int energyTankID,
            GameConstants.eFaction newOwnership)
        {
            var energyTankQuery =
                (from e in db_context.EnergyTanks
                 where e.EnergyTankID == energyTankID
                 select e).SingleOrDefault();

            energyTankQuery.Ownership = (int)newOwnership;

            db_context.SubmitChanges();
        }
示例#4
0
        public static int CreateGame(
            AsyncRPGDataContext context,
            int account_id,
            string game_name,
            GameConstants.eDungeonSize dungeonSize,
            GameConstants.eDungeonDifficulty dungeonDifficulty,
            bool irc_enabled,
            string irc_server,
            int irc_port,
            bool irc_encryption_enabled)
        {
            int new_game_id = -1;

            // Create a random 256-bit (32 byte) encryption key for encrypting chat
            string irc_encryption_key = RNGUtilities.CreateNonDeterministicRandomBase64String(256);
            Debug.Assert(irc_encryption_key.Length == 44);

            if (irc_server.Length == 0)
            {
                irc_server = IrcConstants.DEFAULT_IRC_SERVER;
            }

            if (irc_port < IrcConstants.LOWEST_VALID_IRC_PORT || irc_port > IrcConstants.HIGHEST_VALID_IRC_PORT)
            {
                irc_port = IrcConstants.DEFAULT_IRC_PORT;
            }

            {
                Games newGame = new Games
                {
                    OwnerAccountID = account_id,
                    Name = game_name,
                    DungeonSize = (int)dungeonSize,
                    DungeonDifficulty = (int)dungeonDifficulty,
                    IrcEnabed = irc_enabled,
                    IrcServer = irc_server,
                    IrcPort = irc_port,
                    IrcEncryptionKey = irc_encryption_key,
                    IrcEncryptionEnabed = irc_encryption_enabled
                };

                context.Games.InsertOnSubmit(newGame);
                context.SubmitChanges();

                new_game_id = newGame.GameID;
            }

            return new_game_id;
        }
        public GameCreateRequestProcessor(
            int account_id,
            string game_name,
            GameConstants.eDungeonSize dungeon_size,
            GameConstants.eDungeonDifficulty dungeon_difficulty,
            bool irc_enabled,
            string irc_server,
            int irc_port,
            bool irc_encryption_enabled)
        {
            m_account_id = account_id;
            m_game_name= game_name;
            m_dungeon_size= dungeon_size;
            m_dungeon_difficulty = dungeon_difficulty;
            m_irc_enabled= irc_enabled;
            m_irc_server= irc_server;
            m_irc_port= irc_port;
            m_irc_encryption_enabled= irc_encryption_enabled;

            m_new_game_id = -1;
        }
示例#6
0
 public WorldTemplate(GameConstants.eDungeonSize size, GameConstants.eDungeonDifficulty difficulty)
 {
     dungeon_size = size;
     dungeon_difficulty = difficulty;
 }