Example #1
0
        //public GameState (Player player, int? money = null, int? coin = null, byte[,] pokedex = null,
        //	TimeSpan? time = null, Vector position = new Vector(), float? direction = null, int? scene = null,
        //	int? pokecenter = null, KeyValuePair<GymBadges, DateTime?>[] gym = null, Items[] bag = null,
        //	SeriPC pc = null
        //	)
        //		: this(name: player.Name, money: money, coin: coin, trainer: player.Trainer.TrainerID,
        //				secret: player.Trainer.SecretID, gender: player.Trainer.Gender, pokedex: pokedex,
        //				time: time, position: position, direction: direction, map: scene, pokecenter: pokecenter,
        //				gym: gym, bag: bag, party: player.Trainer.Party.Serialize()
        //			)
        //{
        //}

        //public GameState (string name, Challenges? challenge = null, Feature? features = null, int? money = null, int? coin = null, int? trainer = null, int? secret = null,
        //	bool? gender = null, byte[,] pokedex = null, TimeSpan? time = null, Vector? position = null, float? direction = null, byte? follower = null,
        //	bool? creator = null, int? map = null, byte? box = null, int? pokecenter = null, KeyValuePair<GymBadges, DateTime?>[] gym = null, Items[] bag = null,
        //	SeriPokemon[] party = null, Character.PC pc = null
        //	)
        //{
        //	//BuildVersion		= SaveManager.BuildVersion;//.GetBuildVersion();
        //	TimeCreated			= DateTime.UtcNow;
        //	Challenge			= challenge		?? Challenges.Classic;
        //	Features			= features		?? new Feature();
        //
        //	PlayerName			= name;//		??                                              ;//Game.Player.Name;
        //	PlayerMoney			= money			?? 0											;//Game.Player.Money;
        //	PlayerCoins			= coin			?? 0											;//Game.Player.Coins;
        //	GymsChallenged		= gym			?? new KeyValuePair<GymBadges, DateTime?>[0]	;//Game.Player.GymsBeatTime;
        //	PlayerBag			= bag			?? new Items[0]									;//Game.Bag_Items;//Player.Bag; //playerBag;
        //	TrainerID			= trainer		?? 0											;//Game.Player.Trainer.TrainerID;
        //	SecretID			= secret		?? 0											;//Game.Player.Trainer.SecretID;
        //	IsMale				= gender		?? true											;//Game.Player.isMale;
        //	IsCreator			= creator		?? false										;//Game.Player.IsCreator;
        //	//Pokedex2			= pokedex		??                                              ;//Game.Player.Pokedex;
        //	PlayTime			= time			?? new TimeSpan()								;//Game.Player.PlayTime;
        //	PlayerPosition		= position		?? new Vector()									;//Game.PlayerPosition; //Game.Player.playerPosition;
        //	//PlayerDirection	= direction		?? 0											;//Game.PlayerDirection;//Game.Player.playerDirection;
        //	FollowerPokemon		= follower		?? 0											;//Game.Player.followerPokemon;
        //	ActiveMapId			= map			?? 0											;//Game.Area;//Game.Player.mapName;.activeScene;
        //	//ActivePcBox		= box			?? 0											;//Game.Player.ActivePcBox;
        //	//PlayerPcNames		= boxnames		?? new string[Core.STORAGEBOXES]				;//Game.Player.PC.BoxNAmes;
        //	//PlayerPcTextures	= boxtextures	?? new int[Core.STORAGEBOXES]					;//Game.Player.PC.BoxNAmes;
        //	PokeCenterId		= pokecenter	?? 0											;//(int)Game.Checkpoint;//Game.Player.Checkpoint;pkmnCenter;
        //	PlayerParty			= party			??                                              //Game.Player.Trainer.Party.Serialize();
        //		new SeriPokemon[6];//[player.Party.Length];
        //	for (int i = 0; i < PlayerParty.Length; i++)
        //	{
        //		//PlayerParty[i]= Game.Player.Trainer.Party[i];
        //		PlayerParty[i]	= new SeriPokemon();
        //	}
        //
        //	byte[,] dex2		= pokedex		?? new byte[Game.PokemonData.Where(x => x.Value.IsDefault).Count(), 3];  //Game.Player.Pokedex;
        //	Pokedex = new byte[dex2.GetLength(0)][];
        //	for (int i = 0; i < Pokedex.Length; i++)
        //	{
        //		Pokedex[i] = new byte[dex2.GetLength(1)];
        //		for (int j = 0; j < Pokedex[i].Length; j++)
        //		{
        //			Pokedex[i][j] = (byte)dex2[i, j];
        //		}
        //	}
        //
        //	PlayerPC = pc != null
        //		? new SeriPC(pc)
        //		: new SeriPC(new Monster.Pokemon[Core.STORAGEBOXES, 30], new string[Core.STORAGEBOXES], new int[Core.STORAGEBOXES], new List<Items>());
        //}

        public GameState(Character.Player player, Challenges?challenge = null, Feature?features = null,
                         string overworld = null, string daycare = null, string berry = null, string apricon = null, string npc = null
                         //, string name, int? money = null, int? coin = null, int? trainer = null, int? secret = null,
                         //bool? gender = null, byte[,] pokedex = null, TimeSpan? time = null, Vector? position = null, float? direction = null, byte? follower = null,
                         //bool? creator = null, int? map = null, byte? box = null, int? pokecenter = null, KeyValuePair<GymBadges, DateTime?>[] gym = null, Items[] bag = null,
                         //SeriPokemon[] party = null, Character.PC pc = null
                         )
        {
            //BuildVersion		= SaveManager.BuildVersion;//.GetBuildVersion();
            TimeCreated = player.StartDate;                                // != null	?  DateTimeOffset.Parse(date).UtcDateTime : DateTime.UtcNow;
            Challenge   = challenge ?? Challenges.Classic;
            Features    = features ?? new Feature();

            PlayerName      = player.Name;                       //		??                                              ;//Game.Player.Name;
            PlayerMoney     = player.Money;                      //		?? 0											;//Game.Player.Money;
            PlayerCoins     = player.Coins;                      //		?? 0											;//Game.Player.Coins;
            PlayerSavings   = player.Savings;                    //		?? 0											;
            RepelSteps      = player.RepelSteps;                 //	?? 0											;
            GymsChallenged  = player.GymsBeatTime.ToArray();     //			?? new KeyValuePair<GymBadges, DateTime?>[0]	;//Game.Player.GymsBeatTime;
            PlayerBag       = player.Bag.Contents;               //			?? new Items[0]									;//Game.Bag_Items;//Player.Bag; //playerBag;
            TrainerID       = player.Trainer.TrainerID;          //Game.Player.Trainer.TrainerID;
            SecretID        = player.Trainer.SecretID;           //Game.Player.Trainer.SecretID;
            IsMale          = player.IsMale;                     //		?? true											;//Game.Player.isMale;
            IsCreator       = player.IsCreator;                  //		?? false										;//Game.Player.IsCreator;
            PlayTime        = player.PlayTime;                   //			?? new TimeSpan()								;//Game.Player.PlayTime;
            PlayerPosition  = player.Position;                   //		?? new Vector()									;//Game.PlayerPosition; //Game.Player.playerPosition;
            PlayerDirection = player.Direction;                  //		?? Game.GameData.PlayerDirection;//Game.GameData.Player.playerDirection;
            FollowerPokemon = player.FollowPokemon;              //		?? 0											;//Game.Player.followerPokemon;
            ActiveMapId     = player.Area;                       //			?? 0											;//Game.Area;//Game.Player.mapName;.activeScene;
            //ActivePcBox		= player.box			?? 0											;//Game.Player.ActivePcBox;
            //PlayerPcNames		= player.boxnames		?? new string[Core.STORAGEBOXES]				;//Game.Player.PC.BoxNAmes;
            //PlayerPcTextures	= player.boxtextures	?? new int[Core.STORAGEBOXES]					;//Game.Player.PC.BoxNAmes;
            PokeCenterId = (int)player.Checkpoint;                       //	?? 0											;//(int)Game.Checkpoint;//Game.Player.Checkpoint;pkmnCenter;
            //PlayerOutfit		= player.Outfit;//	?? new Character.PlayerOutfit(0, 0, 0, 0, 0)
            //PlayerDayCare		= player.DayCare	?? new Character.DayCare(0);//
            PlayerParty =                                 //player.Party			??                                              //Game.Player.Trainer.Party.Serialize();
                          new SeriPokemon[player.Party.Length];
            for (int i = 0; i < PlayerParty.Length; i++)
            {
                //PlayerParty[i]= Game.Player.Trainer.Party[i];
                PlayerParty[i] = (SeriPokemon)player.Party[i];
            }

            //byte[,] dex2		= player.Pokedex;//		?? new byte[Game.PokemonData.Where(x => x.Value.IsDefault).Count(), 3];  //Game.Player.Pokedex;
            Pokedex = new byte[player.Pokedex.GetLength(0)][];
            for (int i = 0; i < Pokedex.Length; i++)
            {
                Pokedex[i] = new byte[player.Pokedex.GetLength(1)];
                for (int j = 0; j < Pokedex[i].Length; j++)
                {
                    Pokedex[i][j] = (byte)player.Pokedex[i, j];
                }
            }

            PlayerPC = player.PC != null
                                ? new SeriPC(player.PC)
                                : new SeriPC(new Monster.Pokemon[Core.STORAGEBOXES, 30], new string[Core.STORAGEBOXES], new int[Core.STORAGEBOXES], new List <Items>());
        }
Example #2
0
        public static void LockPokemon(SeriPokemon pokemonToLock)
        {
            OutgoingPacket lockPokemon = new OutgoingPacket(Packets.Outgoing.TradeCommand.LOCK_POKEMON, pokemonToLock);

            NetworkManager.Send(lockPokemon);
        }
Example #3
0
        public static void SetPokemon(SeriPokemon pokemonToSet)
        {
            OutgoingPacket setPokemon = new OutgoingPacket(Packets.Outgoing.TradeCommand.SET_POKEMON, pokemonToSet);

            NetworkManager.Send(setPokemon);
        }
Example #4
0
 /// <summary>
 /// Creates a new Outgoing Trade Packet with the SET_POKEMON Trade Command
 /// </summary>
 /// <param name="pokemonToTrade">The SeriPokemon that needs to be set (visible to the other player)</param>
 public OutgoingPacket(TradeCommand command, SeriPokemon pokemonToTrade)
 {
     Type            = OutgoingPacketType.TRADE;
     PacketContainer = new OTradePacket(command, pokemonToTrade);
 }