Skip to content

Instantly share code, notes, and snippets.

@g0ldPRO
Created March 31, 2016 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save g0ldPRO/6f99a54841471d24bf33f7346472b369 to your computer and use it in GitHub Desktop.
Save g0ldPRO/6f99a54841471d24bf33f7346472b369 to your computer and use it in GitHub Desktop.
using PROAC;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
public class DSSock : MonoBehaviour
{
private class ReadBufferData
{
public string sData;
}
public class cItem
{
public string ItemName;
public int QTY;
public int Scope;
public int ID;
}
public struct PlayerStruct
{
public string pname;
public int money;
public int Coins;
public int X;
public int Y;
public double rep;
public int wins;
public int loses;
public int fishing;
public int disc;
public int tcaught;
public int tseen;
public int tevolve;
public int phours;
public int pmins;
public int member;
public string sprite;
public string Join;
public string Total;
public string Guild;
public string MS;
public string GuildID;
}
public class NPCMessage
{
public string Message;
}
public class ScriptClass
{
public string ID;
public int Status;
public string Message;
public List<DSSock.NPCMessage> Options;
}
public class SavedChats
{
public string Channel;
public string Text;
}
public class SavedChannels
{
public string Name;
public string ID;
}
private const int READ_BUFFER_SIZE = 65536;
public GameObject[] Hazards;
public bool isGirl;
public GameObject MoveGUIs;
public bool SwearHighlight;
public UISlider BTimer;
public MasterSprites MS;
public ManageCDs CDs;
public ManageGuildLogo GLM;
public ShopHandler HandleShop;
public MoveRelearn MR;
public MoveRelearn ER;
public KeyToLabel KeyManager;
public Encoding enc = Encoding.GetEncoding(1252);
public UILabel RankedRating;
public UILabel RankedWins;
public UILabel RankedLosses;
public RankedHandler RankedHandle;
public UILabel GMOTD;
public UILabel GINFO;
public UITexture GLog;
public GuildLogo GLogo;
public float SaySpeed = 70f;
public UISprite MapUpdate;
[HideInInspector]
public float lastEmote;
public MapHandler MH;
public GameObject ShinySparkle;
public GameObject XmasSparkle;
public UILabel OnStatus;
public showEmote PlayerEmote;
public HairColours ColourHairs;
public UITexture[] Parts;
private int serverPort = 800;
private int ConnectionTimeOut = 20000;
public UITexture[] Wearables;
public cPokedex Pokedex;
public PokemonInfo Info;
public GameObject PokemonSlots;
public GameObject SelectPoke;
public GameObject SelectMove;
public GameObject StartScreen;
public GameObject TownButtons;
private int StartStage;
public UILabel StartText;
public MusicPlayer musicPlayer;
public GameObject ItemSlots;
public AudioClip treeSound;
public AudioClip SmashSound;
public ScreenFadeInOut ScreenFade;
public List<cPokemon> Pokemons = new List<cPokemon>();
public List<DSSock.cItem> Items = new List<DSSock.cItem>();
public List<GameObject> PlayerObjects = new List<GameObject>();
[HideInInspector]
public long bytesReceived;
[HideInInspector]
public long bytesSend;
protected static TcpClient tcpClient;
public static DSSock instance;
[HideInInspector]
public bool toDiscon;
[HideInInspector]
public bool isConnected;
private byte[] readBuffer = new byte[65536];
private List<DSSock.ReadBufferData> readBuffers = new List<DSSock.ReadBufferData>();
private string serverIP;
private int storedLength;
[HideInInspector]
public string strMessage = string.Empty;
[HideInInspector]
public string res = string.Empty;
[HideInInspector]
public bool LoggedIn;
[HideInInspector]
public string Message;
[HideInInspector]
public float MessageTime;
[HideInInspector]
public string messageText;
[HideInInspector]
public float messageTimer;
private Vector3 namePlatePos;
[HideInInspector]
public bool isMovable = true;
[HideInInspector]
public byte pDirection = 1;
private byte thisPosition;
[HideInInspector]
public Vector3 newPos;
private string PokeTime;
public int OutSideLight;
[HideInInspector]
public bool bSync;
private bool firstLog = true;
[HideInInspector]
public string currentMap;
[HideInInspector]
public MapCreator mapCreator;
[HideInInspector]
public bool loadingMap;
public UILabel TrainerStats;
public UILabel TrainerStats2;
[HideInInspector]
public bool Leader;
[HideInInspector]
public string gender = "m";
[HideInInspector]
public string hair = "0";
[HideInInspector]
public bool OnGround = true;
public FPoke FollowPoke;
public DSSock.PlayerStruct Players = default(DSSock.PlayerStruct);
public jumpPlayer PlayerJump;
public Transform Player;
public GameObject PlayerObject;
public FPoke PFollowObject;
public UILabel TimeLabel;
public string[] MonsterName = new string[780];
public bool CanMove = true;
public GameObject LoginQueue;
public UILabel QueueLabel;
private bool IDC;
private string Vers = "0.94.1";
public UIPopupList ServerSelect;
private bool NonBlock;
private bool logging;
public UIInput user;
public UIInput pass;
[HideInInspector]
public bool IceUp;
[HideInInspector]
public bool IceDown;
[HideInInspector]
public bool IceLeft;
[HideInInspector]
public bool IceRight;
[HideInInspector]
public int Slide;
[HideInInspector]
private float lastBump;
private bool dontChange;
private bool showDiscon;
public Attacks Atks;
public ItemDes Itms;
public Language Lang;
public UILabel[] TranslateLabels;
public ShowTip[] TranslateTips;
public UITexture FlagFist;
public Texture2D[] FistTexture;
public TileInfo TI;
private SwearFilter TextFiler;
private bool ssh;
private int stepCount;
private int stepCount2;
public Light LightSource;
public Color WhiteColor;
public Color MorningColor;
public Color NightColor;
public Color AfternoonColor;
public Color AfternoonColor2;
public UILabel MText;
[HideInInspector]
public bool moveLeft;
[HideInInspector]
public bool moveRight;
[HideInInspector]
public bool moveUp;
[HideInInspector]
public bool moveDown;
[HideInInspector]
public bool smoveLeft;
[HideInInspector]
public bool smoveRight;
[HideInInspector]
public bool smoveUp;
[HideInInspector]
public bool smoveDown;
public AnimationFramePickerSystem AF;
private float AniTimer;
private int AniNumber;
private int LAniNumber;
private float AniSpeed = 60f;
private string movetomap;
private int movetox;
private int movetoy;
private int movetosurf;
public GameObject GrassObject;
public AudioClip GrassSound;
private float lastMoved;
private float lastPing;
[HideInInspector]
public bool MessageStuck;
[HideInInspector]
public bool Surf;
[HideInInspector]
public bool Bike;
private float LastTimeTextUpdate = -10f;
private KeyCode toggleKey = KeyCode.F2;
public GameObject Console;
public UIInput ConText;
public UITextList con;
public GameObject Darkness;
public bool CanPressKey = true;
private float lastInteracted;
private bool TouchedNext;
private cNPC stopNPC;
public GameObject[] ChoiceButtons;
public UILabel[] ChoiceText;
public GameObject NPCTObject;
public UILabel NPCText;
public AudioClip TextSound;
private bool select;
private float scrollCount;
private int ScrollTo;
private bool Scrolling;
private string tosay;
private bool UpdateBox;
private List<DSSock.NPCMessage> Messages = new List<DSSock.NPCMessage>();
public List<DSSock.ScriptClass> Scripts = new List<DSSock.ScriptClass>();
private List<DSSock.ScriptClass> QuedScripts = new List<DSSock.ScriptClass>();
[HideInInspector]
public bool ScriptPause;
[HideInInspector]
public int doMessages;
[HideInInspector]
public bool NPCLock = true;
private bool FlashOn;
private bool keyLock;
public UITexture[] Badge;
[HideInInspector]
public bool DestroyPacket;
public GameObject Day;
public GameObject Night;
public GameObject Morning;
public GameObject Afternoon;
public UILabel Money;
private float MoveSpeed = 4f;
private int lastBox;
private int lastPMBox;
public GameObject MessageBox;
public GameObject PMObject;
public List<GameObject> PMs = new List<GameObject>();
public List<string> MovePos = new List<string>();
private string NPCMoveID = string.Empty;
private int EvoItemID;
private int PEIDNum;
private int PEID2;
private int PEUID;
private int PEID;
public bool Evolving;
public GameObject EvoScreen;
private Evolution Evos;
public TradeManager Trade;
private string OldSprite;
public List<GameObject> NPCS = new List<GameObject>();
public GameObject NPCObject;
[HideInInspector]
public Vector3 NPCVect;
public GUISkin LoginSkin;
public UITextList ChatText;
private bool canMove = true;
private Rect window;
private float wantedX;
private float wantedY;
private string whatsleft = string.Empty;
public GameObject GUIObjects;
public GameObject loginGUI;
public GameObject optionsGUI;
public GameObject menuGUI;
public UIToggle rememberPass;
public UIInput chatBox;
[HideInInspector]
public bool chatOpen;
public UIWidget[] OptionsWindows;
public UIPopupList ResList;
public UIToggle FullscreenCheck;
public UIToggle VSyncCheck;
public Light Lighting;
[HideInInspector]
public bool WeatherOns;
public UISlider ViewSize;
public UISlider VolumeScroll;
public UISlider MusicScroll;
public GameObject Rain;
public GameObject Draught;
public GameObject Snow;
public UIToggle WeatherOn;
private float currentLight = 0.5f;
private bool Lightning;
private float LightningTimer;
private byte currentWeather;
public AudioClip lightningSound;
[HideInInspector]
public float SFXVolume = 1f;
public UIToggle LightingToggle;
public UIToggle LimitToggle;
public UIToggle LightQuality;
public UIToggle EnableBattleReq;
public UIToggle NPCNames;
public UIToggle ControllerOn;
public UIToggle AnimationsOn;
public UIToggle PlayerNames;
public UISlider DialogueSpeed;
public GameObject bagGUI;
public GameObject creditsGUI;
public GameObject PCBox;
public GameObject BoxPokemon;
public Transform BoxPokemonParent;
private int PokeBoxPage;
public UITexture[] ShortcutTextue;
private int[] ShortcutIDs = new int[4];
private float LastItemUse;
public InventoryButton ItemObject;
public InventoryButton ItemObject2;
public GameObject UseOn;
public UILabel BagLabel;
public UIButton[] BagButtons;
public Transform InventoryParent;
public GameObject trainerGUI;
public GameObject friendsGUI;
public GameObject FriendsScroll;
public UITextList FriendsList;
public UITextList RosterList;
public GameObject ChatPrefab;
public List<GameObject> ChannelButtons;
public Transform TabParent;
public GameObject ChannelPrefab;
public GameObject ChannelManagerObject;
public GameObject ChannelManagerPanel;
public HandleChannels ChannelHandler;
public List<DSSock.SavedChats> SavedChat;
public ChatInput CI;
public List<DSSock.SavedChannels> SavedChan;
public FootStep FSObject;
public FootStep BikeStepObject;
public GameObject BattleScreen;
[HideInInspector]
public bool inBattle;
[HideInInspector]
public bool inTrade;
public ShopManager SM;
public UILabel BattleName;
public UILabel BattleFoe;
public UILabel BattleLog;
private string BattleSay;
private bool BattleScroll;
[HideInInspector]
public int SelPoke;
private int TotalPokes;
public UISprite BattleEXP;
public UISprite[] BattleHP;
private int BattleType;
private int OtherPoke;
private int OtherHP;
private int OtherHPLeft;
private string OtherGender;
private string OtherShiny;
private int HPTO;
private int OTHERHPTO;
public GameObject FoePoke;
public GameObject UserPoke;
private string noBattler = string.Empty;
public UITexture BattleBack;
public Texture2D[] Backgrounds;
private bool resumeMusic;
public string OtherForm = string.Empty;
private bool isPVPBattle;
public float lastPVPMove;
public bool SelectedMove;
private bool throwBall;
private bool throwDown;
public GameObject[] ThrowObject;
private bool throwSound;
private bool showFoe;
private bool BattleIdle;
private int mapMusic;
private int scriptMusic;
public GameObject[] PokeBalls;
public GameObject CaughtBall;
private int BScrollTo;
private float BScrollCount;
public UIPanel BattlePanel;
public UISprite BattleBlanker;
public UIPanel[] UserStats;
public UILabel[] BattlePokeNames;
public GameObject OutOfBall;
public GameObject InTheBall;
public AudioClip BallSound;
private float BAT;
public UIButton[] BattleButtons;
public UIButton[] AttackButtons;
public GameObject LockText;
[HideInInspector]
private bool BatonPass;
private bool FlashFoe;
private bool FlashUser;
private float FlashCounter;
private bool scrollhealth;
private float scrollCounter;
private bool doHealth;
private bool lineTrigger;
public UISprite BLog;
private float hbs;
public int CatchPoke;
private float lastCaught;
private bool CatchPokemon;
private int CatchShakes;
private bool FaintUser;
private bool FaintFoe;
private bool endingBattle;
private int deadPokes;
public UISprite[] PokeStatus;
private string OtherStatus;
public UISprite WeatherSprite;
public AudioClip HitSound;
[HideInInspector]
public bool processingBattle;
private bool restoreUser;
public UISprite CatchBall;
public GameObject AttackObject;
public GameObject PokemonObject;
public GameObject BattleItemObject;
public Transform BattleItemParent;
private bool outrage;
[HideInInspector]
public bool BLock;
private bool lockBattle;
public UILabel[] AttackNames;
public UISprite[] AttackElement;
public UISprite[] AttackType;
public UITexture[] PokemonNames;
public UILabel[] AttackPP;
private int BatonID;
public GameObject MoveGUI;
public GameObject MoveEffect;
public bool ShowLevel = true;
public AudioClip LevelUp;
public UILabel FriendOnline;
public UISprite FriendSprite;
public AudioClip onlineSound;
private static string dLink = "http://pokemon-revolution-online.net";
private static string BugLink = "http://pokemon-revolution-online.net/Forum/viewforum.php?f=6";
private float lastSync;
private float LastQueue;
public void UnlockPlayer()
{
this.CanMove = true;
}
public void LockPlayer()
{
this.CanMove = false;
}
public void SafeDisconnect()
{
this.toDiscon = true;
}
private void Awake()
{
Application.targetFrameRate = 0;
Screen.sleepTimeout = -1;
DSSock.instance = this;
UnityEngine.Object.DontDestroyOnLoad(this);
this.mapCreator = GameObject.Find("Map").GetComponent<MapCreator>();
if (PlayerPrefs.GetInt("width", 0) == 0)
{
Resolution currentResolution = Screen.currentResolution;
Screen.SetResolution(currentResolution.width, currentResolution.height, true);
}
else
{
bool fullscreen = false;
if (PlayerPrefs.GetInt("fs", 0) == 1)
{
fullscreen = true;
}
Screen.SetResolution(PlayerPrefs.GetInt("width", 800), PlayerPrefs.GetInt("height", 600), fullscreen);
}
this.loadOptions();
this.IDC = false;
PROiD.PROSD();
}
[DebuggerHidden]
private IEnumerator ConnectToServer()
{
DSSock.<ConnectToServer>c__IteratorB <ConnectToServer>c__IteratorB = new DSSock.<ConnectToServer>c__IteratorB();
<ConnectToServer>c__IteratorB.<>f__this = this;
return <ConnectToServer>c__IteratorB;
}
[DebuggerHidden]
public IEnumerator ConnectToServerOveride()
{
DSSock.<ConnectToServerOveride>c__IteratorC <ConnectToServerOveride>c__IteratorC = new DSSock.<ConnectToServerOveride>c__IteratorC();
<ConnectToServerOveride>c__IteratorC.<>f__this = this;
return <ConnectToServerOveride>c__IteratorC;
}
protected void BeginConnect()
{
try
{
DSSock.tcpClient = new TcpClient();
DSSock.tcpClient.Connect(this.serverIP, this.serverPort);
DSSock.tcpClient.GetStream().BeginRead(DSSock.instance.readBuffer, 0, 65536, new AsyncCallback(DSSock.instance.doRead), null);
this.isConnected = DSSock.tcpClient.Connected;
if (!this.isConnected)
{
DSSock.tcpClient = null;
}
}
catch (Exception ex)
{
this.isConnected = false;
UnityEngine.Debug.Log(ex.ToString());
}
}
public void Login()
{
float orthographicSize = (float)Screen.height / 64f / 2f;
Camera.main.orthographicSize = orthographicSize;
if (this.LoggedIn || this.isConnected || this.logging)
{
return;
}
this.readBuffers = new List<DSSock.ReadBufferData>();
if (!this.logging)
{
this.user.value = this.user.value.Replace(" ", string.Empty);
if ((!(this.user.value.ToLower() == "red") && this.user.value.Length <= 3) || this.pass.value.Length <= 3 || !(this.user.value != "Username") || !(this.pass.value != "Password"))
{
this.res = this.Lang.GetString("UPShort");
GUI.enabled = true;
return;
}
this.logging = true;
this.con.Add("PRO> Connecting to Server.");
this.res = this.Lang.GetString("Connect");
base.StartCoroutine("ConnectToServer");
}
}
[HideInInspector]
private void PlayBump()
{
}
public bool GetIce(int x, int y)
{
return this.TI.Ice[this.mapCreator.Tiles[x, y]] != 0 || this.TI.Ice[this.mapCreator.Tiles2[x, y]] != 0 || this.TI.Ice[this.mapCreator.Tiles3[x, y]] != 0;
}
public int GetSlide(int x, int y)
{
if (this.TI.MoveUp[this.mapCreator.Tiles[x, y]] != 0 || this.TI.MoveUp[this.mapCreator.Tiles2[x, y]] != 0 || this.TI.MoveUp[this.mapCreator.Tiles3[x, y]] != 0)
{
return 1;
}
if (this.TI.MoveDown[this.mapCreator.Tiles[x, y]] != 0 || this.TI.MoveDown[this.mapCreator.Tiles2[x, y]] != 0 || this.TI.MoveDown[this.mapCreator.Tiles3[x, y]] != 0)
{
return 2;
}
if (this.TI.MoveLeft[this.mapCreator.Tiles[x, y]] != 0 || this.TI.MoveLeft[this.mapCreator.Tiles2[x, y]] != 0 || this.TI.MoveLeft[this.mapCreator.Tiles3[x, y]] != 0)
{
return 3;
}
if (this.TI.MoveRight[this.mapCreator.Tiles[x, y]] != 0 || this.TI.MoveRight[this.mapCreator.Tiles2[x, y]] != 0 || this.TI.MoveRight[this.mapCreator.Tiles3[x, y]] != 0)
{
return 4;
}
if (this.TI.Stop[this.mapCreator.Tiles[x, y]] != 0 || this.TI.Stop[this.mapCreator.Tiles2[x, y]] != 0 || this.TI.Stop[this.mapCreator.Tiles3[x, y]] != 0)
{
return 5;
}
return 0;
}
public void HidePokeInfo()
{
this.Info.gameObject.SetActive(false);
}
public void Disconnect()
{
this.LoginQueue.SetActive(false);
this.SavedChat = new List<DSSock.SavedChats>();
this.Leader = false;
this.MH.DestroyView();
this.CDs.Reset();
this.OnStatus.text = "[ON] Appear Online";
this.trainerGUI.SetActive(false);
this.Info.gameObject.SetActive(false);
this.Pokedex.DestroyDex();
this.ChannelHandler.No();
this.ChannelManagerPanel.GetComponent<UIPanel>().alpha = 0f;
this.Slide = 0;
this.IceUp = false;
this.IceDown = false;
this.IceLeft = false;
this.IceRight = false;
this.select = false;
this.noBattler = string.Empty;
this.SM.Close_Shop();
this.SelectPoke.SetActive(false);
this.PCBox.SetActive(false);
this.MoveGUI.GetComponent<LearnMove>().StoredMoves.Clear();
this.MoveGUI.GetComponent<LearnMove>().PauseLearn = false;
this.MR.ClosePanel();
this.ER.ClosePanel();
this.Pokemons = new List<cPokemon>();
this.PlayerObjects = new List<GameObject>();
this.Items = new List<DSSock.cItem>();
this.friendsGUI.SetActive(false);
this.Trade.Hide_Trade();
this.StartScreen.SetActive(false);
this.StartStage = 0;
this.MovePos.Clear();
this.FlashOn = false;
this.EvoItemID = 0;
this.PEIDNum = 0;
this.PEID2 = 0;
this.PEUID = 0;
this.PEID = 0;
this.Evolving = false;
this.EvoScreen.SetActive(false);
this.DestroyPMS();
this.DestroyNPC();
if (this.isConnected && DSSock.tcpClient != null)
{
DSSock.tcpClient.Close();
}
this.HideBattle();
this.doMessages = 0;
this.CanMove = true;
this.Bike = false;
this.Surf = false;
this.MoveSpeed = 4f;
this.FollowPoke.MoveSpeed = 4f;
this.MessageStuck = false;
this.Scripts = new List<DSSock.ScriptClass>();
this.QuedScripts = new List<DSSock.ScriptClass>();
this.ScriptPause = false;
this.SelPoke = 0;
this.NPCLock = true;
this.OnGround = true;
this.toDiscon = false;
DSSock.tcpClient = null;
this.isConnected = false;
this.LoggedIn = false;
this.logging = false;
this.Players = default(DSSock.PlayerStruct);
this.currentMap = string.Empty;
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.RosterList.Clear();
this.Draught.SetActive(false);
this.ChatText.Clear();
this.mapCreator.DestroyMap();
this.optionsGUI.SetActive(false);
this.GUIObjects.SetActive(false);
this.menuGUI.SetActive(false);
this.loginGUI.SetActive(true);
this.ScreenFade.ResetScene();
this.FollowPoke.PokeID(0, 0, 0);
this.FollowPoke.LastPostion = Vector3.zero;
this.bytesReceived = 0L;
this.NPCTObject.SetActive(false);
this.NPCText.text = string.Empty;
this.PlayMusic(0);
this.MessageTime = 0f;
this.Message = string.Empty;
for (int i = 0; i < 24; i++)
{
this.Badge[i].color = new Color(0f, 0f, 0f, 0.7f);
}
this.mapCreator.DestroyTotalMap();
Resources.UnloadUnusedAssets();
this.loginGUI.GetComponent<GrabNews>().ReloadOnline();
}
private void loadTiles()
{
this.MonsterName[0] = "???";
this.MonsterName[1] = "Bulbasaur";
this.MonsterName[2] = "Ivysaur";
this.MonsterName[3] = "Venusaur";
this.MonsterName[4] = "Charmander";
this.MonsterName[5] = "Charmeleon";
this.MonsterName[6] = "Charizard";
this.MonsterName[7] = "Squirtle";
this.MonsterName[8] = "Wartortle";
this.MonsterName[9] = "Blastoise";
this.MonsterName[10] = "Caterpie";
this.MonsterName[11] = "Metapod";
this.MonsterName[12] = "Butterfree";
this.MonsterName[13] = "Weedle";
this.MonsterName[14] = "Kakuna";
this.MonsterName[15] = "Beedrill";
this.MonsterName[16] = "Pidgey";
this.MonsterName[17] = "Pidgeotto";
this.MonsterName[18] = "Pidgeot";
this.MonsterName[19] = "Rattata";
this.MonsterName[20] = "Raticate";
this.MonsterName[21] = "Spearow";
this.MonsterName[22] = "Fearow";
this.MonsterName[23] = "Ekans";
this.MonsterName[24] = "Arbok";
this.MonsterName[25] = "Pikachu";
this.MonsterName[26] = "Raichu";
this.MonsterName[27] = "Sandshrew";
this.MonsterName[28] = "Sandslash";
this.MonsterName[29] = "Nidoran F";
this.MonsterName[30] = "Nidorina";
this.MonsterName[31] = "Nidoqueen";
this.MonsterName[32] = "Nidoran M";
this.MonsterName[33] = "Nidorino";
this.MonsterName[34] = "Nidoking";
this.MonsterName[35] = "Clefairy";
this.MonsterName[36] = "Clefable";
this.MonsterName[37] = "Vulpix";
this.MonsterName[38] = "Ninetales";
this.MonsterName[39] = "Jigglypuff";
this.MonsterName[40] = "Wigglytuff";
this.MonsterName[41] = "Zubat";
this.MonsterName[42] = "Golbat";
this.MonsterName[43] = "Oddish";
this.MonsterName[44] = "Gloom";
this.MonsterName[45] = "Vileplume";
this.MonsterName[46] = "Paras";
this.MonsterName[47] = "Parasect";
this.MonsterName[48] = "Venonat";
this.MonsterName[49] = "Venomoth";
this.MonsterName[50] = "Diglett";
this.MonsterName[51] = "Dugtrio";
this.MonsterName[52] = "Meowth";
this.MonsterName[53] = "Persian";
this.MonsterName[54] = "Psyduck";
this.MonsterName[55] = "Golduck";
this.MonsterName[56] = "Mankey";
this.MonsterName[57] = "Primeape";
this.MonsterName[58] = "Growlithe";
this.MonsterName[59] = "Arcanine";
this.MonsterName[60] = "Poliwag";
this.MonsterName[61] = "Poliwhirl";
this.MonsterName[62] = "Poliwrath";
this.MonsterName[63] = "Abra";
this.MonsterName[64] = "Kadabra";
this.MonsterName[65] = "Alakazam";
this.MonsterName[66] = "Machop";
this.MonsterName[67] = "Machoke";
this.MonsterName[68] = "Machamp";
this.MonsterName[69] = "Bellsprout";
this.MonsterName[70] = "Weepinbell";
this.MonsterName[71] = "Victreebel";
this.MonsterName[72] = "Tentacool";
this.MonsterName[73] = "Tentacruel";
this.MonsterName[74] = "Geodude";
this.MonsterName[75] = "Graveler";
this.MonsterName[76] = "Golem";
this.MonsterName[77] = "Ponyta";
this.MonsterName[78] = "Rapidash";
this.MonsterName[79] = "Slowpoke";
this.MonsterName[80] = "Slowbro";
this.MonsterName[81] = "Magnemite";
this.MonsterName[82] = "Magneton";
this.MonsterName[83] = "Farfetch 'd";
this.MonsterName[84] = "Doduo";
this.MonsterName[85] = "Dodrio";
this.MonsterName[86] = "Seel";
this.MonsterName[87] = "Dewgong";
this.MonsterName[88] = "Grimer";
this.MonsterName[89] = "Muk";
this.MonsterName[90] = "Shellder";
this.MonsterName[91] = "Cloyster";
this.MonsterName[92] = "Gastly";
this.MonsterName[93] = "Haunter";
this.MonsterName[94] = "Gengar";
this.MonsterName[95] = "Onix";
this.MonsterName[96] = "Drowzee";
this.MonsterName[97] = "Hypno";
this.MonsterName[98] = "Krabby";
this.MonsterName[99] = "Kingler";
this.MonsterName[100] = "Voltorb";
this.MonsterName[101] = "Electrode";
this.MonsterName[102] = "Exeggcute";
this.MonsterName[103] = "Exeggutor";
this.MonsterName[104] = "Cubone";
this.MonsterName[105] = "Marowak";
this.MonsterName[106] = "Hitmonlee";
this.MonsterName[107] = "Hitmonchan";
this.MonsterName[108] = "Lickitung";
this.MonsterName[109] = "Koffing";
this.MonsterName[110] = "Weezing";
this.MonsterName[111] = "Rhyhorn";
this.MonsterName[112] = "Rhydon";
this.MonsterName[113] = "Chansey";
this.MonsterName[114] = "Tangela";
this.MonsterName[115] = "Kangaskhan";
this.MonsterName[116] = "Horsea";
this.MonsterName[117] = "Seadra";
this.MonsterName[118] = "Goldeen";
this.MonsterName[119] = "Seaking";
this.MonsterName[120] = "Staryu";
this.MonsterName[121] = "Starmie";
this.MonsterName[122] = "Mr. Mime";
this.MonsterName[123] = "Scyther";
this.MonsterName[124] = "Jynx";
this.MonsterName[125] = "Electabuzz";
this.MonsterName[126] = "Magmar";
this.MonsterName[127] = "Pinsir";
this.MonsterName[128] = "Tauros";
this.MonsterName[129] = "Magikarp";
this.MonsterName[130] = "Gyarados";
this.MonsterName[131] = "Lapras";
this.MonsterName[132] = "Ditto";
this.MonsterName[133] = "Eevee";
this.MonsterName[134] = "Vaporeon";
this.MonsterName[135] = "Jolteon";
this.MonsterName[136] = "Flareon";
this.MonsterName[137] = "Porygon";
this.MonsterName[138] = "Omanyte";
this.MonsterName[139] = "Omastar";
this.MonsterName[140] = "Kabuto";
this.MonsterName[141] = "Kabutops";
this.MonsterName[142] = "Aerodactyl";
this.MonsterName[143] = "Snorlax";
this.MonsterName[144] = "Articuno";
this.MonsterName[145] = "Zapdos";
this.MonsterName[146] = "Moltres";
this.MonsterName[147] = "Dratini";
this.MonsterName[148] = "Dragonair";
this.MonsterName[149] = "Dragonite";
this.MonsterName[150] = "Mewtwo";
this.MonsterName[151] = "Mew";
this.MonsterName[152] = "Chikorita";
this.MonsterName[153] = "Bayleef";
this.MonsterName[154] = "Meganium";
this.MonsterName[155] = "Cyndaquil";
this.MonsterName[156] = "Quilava";
this.MonsterName[157] = "Typhlosion";
this.MonsterName[158] = "Totodile";
this.MonsterName[159] = "Croconaw";
this.MonsterName[160] = "Feraligatr";
this.MonsterName[161] = "Sentret";
this.MonsterName[162] = "Furret";
this.MonsterName[163] = "Hoothoot";
this.MonsterName[164] = "Noctowl";
this.MonsterName[165] = "Ledyba";
this.MonsterName[166] = "Ledian";
this.MonsterName[167] = "Spinarak";
this.MonsterName[168] = "Ariados";
this.MonsterName[169] = "Crobat";
this.MonsterName[170] = "Chinchou";
this.MonsterName[171] = "Lanturn";
this.MonsterName[172] = "Pichu";
this.MonsterName[173] = "Cleffa";
this.MonsterName[174] = "Igglybuff";
this.MonsterName[175] = "Togepi";
this.MonsterName[176] = "Togetic";
this.MonsterName[177] = "Natu";
this.MonsterName[178] = "Xatu";
this.MonsterName[179] = "Mareep";
this.MonsterName[180] = "Flaaffy";
this.MonsterName[181] = "Ampharos";
this.MonsterName[182] = "Bellossom";
this.MonsterName[183] = "Marill";
this.MonsterName[184] = "Azumarill";
this.MonsterName[185] = "Sudowoodo";
this.MonsterName[186] = "Politoed";
this.MonsterName[187] = "Hoppip";
this.MonsterName[188] = "Skiploom";
this.MonsterName[189] = "Jumpluff";
this.MonsterName[190] = "Aipom";
this.MonsterName[191] = "Sunkern";
this.MonsterName[192] = "Sunflora";
this.MonsterName[193] = "Yanma";
this.MonsterName[194] = "Wooper";
this.MonsterName[195] = "Quagsire";
this.MonsterName[196] = "Espeon";
this.MonsterName[197] = "Umbreon";
this.MonsterName[198] = "Murkrow";
this.MonsterName[199] = "Slowking";
this.MonsterName[200] = "Misdreavus";
this.MonsterName[201] = "Unown";
this.MonsterName[202] = "Wobbuffet";
this.MonsterName[203] = "Girafarig";
this.MonsterName[204] = "Pineco";
this.MonsterName[205] = "Forretress";
this.MonsterName[206] = "Dunsparce";
this.MonsterName[207] = "Gligar";
this.MonsterName[208] = "Steelix";
this.MonsterName[209] = "Snubbull";
this.MonsterName[210] = "Granbull";
this.MonsterName[211] = "Qwilfish";
this.MonsterName[212] = "Scizor";
this.MonsterName[213] = "Shuckle";
this.MonsterName[214] = "Heracross";
this.MonsterName[215] = "Sneasel";
this.MonsterName[216] = "Teddiursa";
this.MonsterName[217] = "Ursaring";
this.MonsterName[218] = "Slugma";
this.MonsterName[219] = "Magcargo";
this.MonsterName[220] = "Swinub";
this.MonsterName[221] = "Piloswine";
this.MonsterName[222] = "Corsola";
this.MonsterName[223] = "Remoraid";
this.MonsterName[224] = "Octillery";
this.MonsterName[225] = "Delibird";
this.MonsterName[226] = "Mantine";
this.MonsterName[227] = "Skarmory";
this.MonsterName[228] = "Houndour";
this.MonsterName[229] = "Houndoom";
this.MonsterName[230] = "Kingdra";
this.MonsterName[231] = "Phanpy";
this.MonsterName[232] = "Donphan";
this.MonsterName[233] = "Porygon2";
this.MonsterName[234] = "Stantler";
this.MonsterName[235] = "Smeargle";
this.MonsterName[236] = "Tyrogue";
this.MonsterName[237] = "Hitmontop";
this.MonsterName[238] = "Smoochum";
this.MonsterName[239] = "Elekid";
this.MonsterName[240] = "Magby";
this.MonsterName[241] = "Miltank";
this.MonsterName[242] = "Blissey";
this.MonsterName[243] = "Raikou";
this.MonsterName[244] = "Entei";
this.MonsterName[245] = "Suicune";
this.MonsterName[246] = "Larvitar";
this.MonsterName[247] = "Pupitar";
this.MonsterName[248] = "Tyranitar";
this.MonsterName[249] = "Lugia";
this.MonsterName[250] = "Ho-oh";
this.MonsterName[251] = "Celebi";
this.MonsterName[252] = "Treecko";
this.MonsterName[253] = "Grovyle";
this.MonsterName[254] = "Sceptile";
this.MonsterName[255] = "Torchic";
this.MonsterName[256] = "Combusken";
this.MonsterName[257] = "Blaziken";
this.MonsterName[258] = "Mudkip";
this.MonsterName[259] = "Marshtomp";
this.MonsterName[260] = "Swampert";
this.MonsterName[261] = "Poochyena";
this.MonsterName[262] = "Mightyena";
this.MonsterName[263] = "Zigzagoon";
this.MonsterName[264] = "Linoone";
this.MonsterName[265] = "Wurmple";
this.MonsterName[266] = "Silcoon";
this.MonsterName[267] = "Beautifly";
this.MonsterName[268] = "Cascoon";
this.MonsterName[269] = "Dustox";
this.MonsterName[270] = "Lotad";
this.MonsterName[271] = "Lombre";
this.MonsterName[272] = "Ludicolo";
this.MonsterName[273] = "Seedot";
this.MonsterName[274] = "Nuzleaf";
this.MonsterName[275] = "Shiftry";
this.MonsterName[276] = "Taillow";
this.MonsterName[277] = "Swellow";
this.MonsterName[278] = "Wingull";
this.MonsterName[279] = "Pelipper";
this.MonsterName[280] = "Ralts";
this.MonsterName[281] = "Kirlia";
this.MonsterName[282] = "Gardevoir";
this.MonsterName[283] = "Surskit";
this.MonsterName[284] = "Masquerain";
this.MonsterName[285] = "Shroomish";
this.MonsterName[286] = "Breloom";
this.MonsterName[287] = "Slakoth";
this.MonsterName[288] = "Vigoroth";
this.MonsterName[289] = "Slaking";
this.MonsterName[290] = "Nincada";
this.MonsterName[291] = "Ninjask";
this.MonsterName[292] = "Shedinja";
this.MonsterName[293] = "Whismur";
this.MonsterName[294] = "Loudred";
this.MonsterName[295] = "Exploud";
this.MonsterName[296] = "Makuhita";
this.MonsterName[297] = "Hariyama";
this.MonsterName[298] = "Azurill";
this.MonsterName[299] = "Nosepass";
this.MonsterName[300] = "Skitty";
this.MonsterName[301] = "Delcatty";
this.MonsterName[302] = "Sableye";
this.MonsterName[303] = "Mawile";
this.MonsterName[304] = "Aron";
this.MonsterName[305] = "Lairon";
this.MonsterName[306] = "Aggron";
this.MonsterName[307] = "Meditite";
this.MonsterName[308] = "Medicham";
this.MonsterName[309] = "Electrike";
this.MonsterName[310] = "Manectric";
this.MonsterName[311] = "Plusle";
this.MonsterName[312] = "Minun";
this.MonsterName[313] = "Volbeat";
this.MonsterName[314] = "Illumise";
this.MonsterName[315] = "Roselia";
this.MonsterName[316] = "Gulpin";
this.MonsterName[317] = "Swalot";
this.MonsterName[318] = "Carvanha";
this.MonsterName[319] = "Sharpedo";
this.MonsterName[320] = "Wailmer";
this.MonsterName[321] = "Wailord";
this.MonsterName[322] = "Numel";
this.MonsterName[323] = "Camerupt";
this.MonsterName[324] = "Torkoal";
this.MonsterName[325] = "Spoink";
this.MonsterName[326] = "Grumpig";
this.MonsterName[327] = "Spinda";
this.MonsterName[328] = "Trapinch";
this.MonsterName[329] = "Vibrava";
this.MonsterName[330] = "Flygon";
this.MonsterName[331] = "Cacnea";
this.MonsterName[332] = "Cacturne";
this.MonsterName[333] = "Swablu";
this.MonsterName[334] = "Altaria";
this.MonsterName[335] = "Zangoose";
this.MonsterName[336] = "Seviper";
this.MonsterName[337] = "Lunatone";
this.MonsterName[338] = "Solrock";
this.MonsterName[339] = "Barboach";
this.MonsterName[340] = "Whiscash";
this.MonsterName[341] = "Corphish";
this.MonsterName[342] = "Crawdaunt";
this.MonsterName[343] = "Baltoy";
this.MonsterName[344] = "Claydol";
this.MonsterName[345] = "Lileep";
this.MonsterName[346] = "Cradily";
this.MonsterName[347] = "Anorith";
this.MonsterName[348] = "Armaldo";
this.MonsterName[349] = "Feebas";
this.MonsterName[350] = "Milotic";
this.MonsterName[351] = "Castform";
this.MonsterName[352] = "Kecleon";
this.MonsterName[353] = "Shuppet";
this.MonsterName[354] = "Banette";
this.MonsterName[355] = "Duskull";
this.MonsterName[356] = "Dusclops";
this.MonsterName[357] = "Tropius";
this.MonsterName[358] = "Chimecho";
this.MonsterName[359] = "Absol";
this.MonsterName[360] = "Wynaut";
this.MonsterName[361] = "Snorunt";
this.MonsterName[362] = "Glalie";
this.MonsterName[363] = "Spheal";
this.MonsterName[364] = "Sealeo";
this.MonsterName[365] = "Walrein";
this.MonsterName[366] = "Clamperl";
this.MonsterName[367] = "Huntail";
this.MonsterName[368] = "Gorebyss";
this.MonsterName[369] = "Relicanth";
this.MonsterName[370] = "Luvdisc";
this.MonsterName[371] = "Bagon";
this.MonsterName[372] = "Shelgon";
this.MonsterName[373] = "Salamence";
this.MonsterName[374] = "Beldum";
this.MonsterName[375] = "Metang";
this.MonsterName[376] = "Metagross";
this.MonsterName[377] = "Regirock";
this.MonsterName[378] = "Regice";
this.MonsterName[379] = "Registeel";
this.MonsterName[380] = "Latias";
this.MonsterName[381] = "Latios";
this.MonsterName[382] = "Kyogre";
this.MonsterName[383] = "Groudon";
this.MonsterName[384] = "Rayquaza";
this.MonsterName[385] = "Jirachi";
this.MonsterName[386] = "Deoxys";
this.MonsterName[387] = "Turtwig";
this.MonsterName[388] = "Grotle";
this.MonsterName[389] = "Torterra";
this.MonsterName[390] = "Chimchar";
this.MonsterName[391] = "Monferno";
this.MonsterName[392] = "Infernape";
this.MonsterName[393] = "Piplup";
this.MonsterName[394] = "Prinplup";
this.MonsterName[395] = "Empoleon";
this.MonsterName[396] = "Starly";
this.MonsterName[397] = "Staravia";
this.MonsterName[398] = "Staraptor";
this.MonsterName[399] = "Bidoof";
this.MonsterName[400] = "Bibarel";
this.MonsterName[401] = "Kricketot";
this.MonsterName[402] = "Kricketune";
this.MonsterName[403] = "Shinx";
this.MonsterName[404] = "Luxio";
this.MonsterName[405] = "Luxray";
this.MonsterName[406] = "Budew";
this.MonsterName[407] = "Roserade";
this.MonsterName[408] = "Cranidos";
this.MonsterName[409] = "Rampardos";
this.MonsterName[410] = "Shieldon";
this.MonsterName[411] = "Bastiodon";
this.MonsterName[412] = "Burmy";
this.MonsterName[413] = "Wormadam";
this.MonsterName[414] = "Mothim";
this.MonsterName[415] = "Combee";
this.MonsterName[416] = "Vespiquen";
this.MonsterName[417] = "Pachirisu";
this.MonsterName[418] = "Buizel";
this.MonsterName[419] = "Floatzel";
this.MonsterName[420] = "Cherubi";
this.MonsterName[421] = "Cherrim";
this.MonsterName[422] = "Shellos";
this.MonsterName[423] = "Gastrodon";
this.MonsterName[424] = "Ambipom";
this.MonsterName[425] = "Drifloon";
this.MonsterName[426] = "Drifblim";
this.MonsterName[427] = "Buneary";
this.MonsterName[428] = "Lopunny";
this.MonsterName[429] = "Mismagius";
this.MonsterName[430] = "Honchkrow";
this.MonsterName[431] = "Glameow";
this.MonsterName[432] = "Purugly";
this.MonsterName[433] = "Chingling";
this.MonsterName[434] = "Stunky";
this.MonsterName[435] = "Skuntank";
this.MonsterName[436] = "Bronzor";
this.MonsterName[437] = "Bronzong";
this.MonsterName[438] = "Bonsly";
this.MonsterName[439] = "Mime Jr.";
this.MonsterName[440] = "Happiny";
this.MonsterName[441] = "Chatot";
this.MonsterName[442] = "Spiritomb";
this.MonsterName[443] = "Gible";
this.MonsterName[444] = "Gabite";
this.MonsterName[445] = "Garchomp";
this.MonsterName[446] = "Munchlax";
this.MonsterName[447] = "Riolu";
this.MonsterName[448] = "Lucario";
this.MonsterName[449] = "Hippopotas";
this.MonsterName[450] = "Hippowdon";
this.MonsterName[451] = "Skorupi";
this.MonsterName[452] = "Drapion";
this.MonsterName[453] = "Croagunk";
this.MonsterName[454] = "Toxicroak";
this.MonsterName[455] = "Carnivine";
this.MonsterName[456] = "Finneon";
this.MonsterName[457] = "Lumineon";
this.MonsterName[458] = "Mantyke";
this.MonsterName[459] = "Snover";
this.MonsterName[460] = "Abomasnow";
this.MonsterName[461] = "Weavile";
this.MonsterName[462] = "Magnezone";
this.MonsterName[463] = "Lickilicky";
this.MonsterName[464] = "Rhyperior";
this.MonsterName[465] = "Tangrowth";
this.MonsterName[466] = "Electivire";
this.MonsterName[467] = "Magmortar";
this.MonsterName[468] = "Togekiss";
this.MonsterName[469] = "Yanmega";
this.MonsterName[470] = "Leafeon";
this.MonsterName[471] = "Glaceon";
this.MonsterName[472] = "Gliscor";
this.MonsterName[473] = "Mamoswine";
this.MonsterName[474] = "Porygon-Z";
this.MonsterName[475] = "Gallade";
this.MonsterName[476] = "Probopass";
this.MonsterName[477] = "Dusknoir";
this.MonsterName[478] = "Froslass";
this.MonsterName[479] = "Rotom";
this.MonsterName[480] = "Uxie";
this.MonsterName[481] = "Mesprit";
this.MonsterName[482] = "Azelf";
this.MonsterName[483] = "Dialga";
this.MonsterName[484] = "Palkia";
this.MonsterName[485] = "Heatran";
this.MonsterName[486] = "Regigigas";
this.MonsterName[487] = "Giratina";
this.MonsterName[488] = "Cresselia";
this.MonsterName[489] = "Phione";
this.MonsterName[490] = "Manaphy";
this.MonsterName[491] = "Darkrai";
this.MonsterName[492] = "Shaymin";
this.MonsterName[493] = "Arceus";
this.MonsterName[494] = "Victini";
this.MonsterName[495] = "Snivy";
this.MonsterName[496] = "Servine";
this.MonsterName[497] = "Serperior";
this.MonsterName[498] = "Tepig";
this.MonsterName[499] = "Pignite";
this.MonsterName[500] = "Emboar";
this.MonsterName[501] = "Oshawott";
this.MonsterName[502] = "Dewott";
this.MonsterName[503] = "Samurott";
this.MonsterName[504] = "Patrat";
this.MonsterName[505] = "Watchog";
this.MonsterName[506] = "Lillipup";
this.MonsterName[507] = "Herdier";
this.MonsterName[508] = "Stoutland";
this.MonsterName[509] = "Purrloin";
this.MonsterName[510] = "Liepard";
this.MonsterName[511] = "Pansage";
this.MonsterName[512] = "Simisage";
this.MonsterName[513] = "Pansear";
this.MonsterName[514] = "Simisear";
this.MonsterName[515] = "Panpour";
this.MonsterName[516] = "Simipour";
this.MonsterName[517] = "Munna";
this.MonsterName[518] = "Musharna";
this.MonsterName[519] = "Pidove";
this.MonsterName[520] = "Tranquill";
this.MonsterName[521] = "Unfezant";
this.MonsterName[522] = "Blitzle";
this.MonsterName[523] = "Zebstrika";
this.MonsterName[524] = "Roggenrola";
this.MonsterName[525] = "Boldore";
this.MonsterName[526] = "Gigalith";
this.MonsterName[527] = "Woobat";
this.MonsterName[528] = "Swoobat";
this.MonsterName[529] = "Drilbur";
this.MonsterName[530] = "Excadrill";
this.MonsterName[531] = "Audino";
this.MonsterName[532] = "Timburr";
this.MonsterName[533] = "Gurdurr";
this.MonsterName[534] = "Conkeldurr";
this.MonsterName[535] = "Tympole";
this.MonsterName[536] = "Palpitoad";
this.MonsterName[537] = "Seismitoad";
this.MonsterName[538] = "Throh";
this.MonsterName[539] = "Sawk";
this.MonsterName[540] = "Sewaddle";
this.MonsterName[541] = "Swadloon";
this.MonsterName[542] = "Leavanny";
this.MonsterName[543] = "Venipede";
this.MonsterName[544] = "Whirlipede";
this.MonsterName[545] = "Scolipede";
this.MonsterName[546] = "Cottonee";
this.MonsterName[547] = "Whimsicott";
this.MonsterName[548] = "Petilil";
this.MonsterName[549] = "Lilligant";
this.MonsterName[550] = "Basculin";
this.MonsterName[551] = "Sandile";
this.MonsterName[552] = "Krokorok";
this.MonsterName[553] = "Krookodile";
this.MonsterName[554] = "Darumaka";
this.MonsterName[555] = "Darmanitan";
this.MonsterName[556] = "Maractus";
this.MonsterName[557] = "Dwebble";
this.MonsterName[558] = "Crustle";
this.MonsterName[559] = "Scraggy";
this.MonsterName[560] = "Scrafty";
this.MonsterName[561] = "Sigilyph";
this.MonsterName[562] = "Yamask";
this.MonsterName[563] = "Cofagrigus";
this.MonsterName[564] = "Tirtouga";
this.MonsterName[565] = "Carracosta";
this.MonsterName[566] = "Archen";
this.MonsterName[567] = "Archeops";
this.MonsterName[568] = "Trubbish";
this.MonsterName[569] = "Garbodor";
this.MonsterName[570] = "Zorua";
this.MonsterName[571] = "Zoroark";
this.MonsterName[572] = "Minccino";
this.MonsterName[573] = "Cinccino";
this.MonsterName[574] = "Gothita";
this.MonsterName[575] = "Gothorita";
this.MonsterName[576] = "Gothitelle";
this.MonsterName[577] = "Solosis";
this.MonsterName[578] = "Duosion";
this.MonsterName[579] = "Reuniclus";
this.MonsterName[580] = "Ducklett";
this.MonsterName[581] = "Swanna";
this.MonsterName[582] = "Vanillite";
this.MonsterName[583] = "Vanillish";
this.MonsterName[584] = "Vanilluxe";
this.MonsterName[585] = "Deerling";
this.MonsterName[586] = "Sawsbuck";
this.MonsterName[587] = "Emolga";
this.MonsterName[588] = "Karrablast";
this.MonsterName[589] = "Escavalier";
this.MonsterName[590] = "Foongus";
this.MonsterName[591] = "Amoonguss";
this.MonsterName[592] = "Frillish";
this.MonsterName[593] = "Jellicent";
this.MonsterName[594] = "Alomomola";
this.MonsterName[595] = "Joltik";
this.MonsterName[596] = "Galvantula";
this.MonsterName[597] = "Ferroseed";
this.MonsterName[598] = "Ferrothorn";
this.MonsterName[599] = "Klink";
this.MonsterName[600] = "Klang";
this.MonsterName[601] = "Klinklang";
this.MonsterName[602] = "Tynamo";
this.MonsterName[603] = "Eelektrik";
this.MonsterName[604] = "Eelektross";
this.MonsterName[605] = "Elgyem";
this.MonsterName[606] = "Beheeyem";
this.MonsterName[607] = "Litwick";
this.MonsterName[608] = "Lampent";
this.MonsterName[609] = "Chandelure";
this.MonsterName[610] = "Axew";
this.MonsterName[611] = "Fraxure";
this.MonsterName[612] = "Haxorus";
this.MonsterName[613] = "Cubchoo";
this.MonsterName[614] = "Beartic";
this.MonsterName[615] = "Cryogonal";
this.MonsterName[616] = "Shelmet";
this.MonsterName[617] = "Accelgor";
this.MonsterName[618] = "Stunfisk";
this.MonsterName[619] = "Mienfoo";
this.MonsterName[620] = "Mienshao";
this.MonsterName[621] = "Druddigon";
this.MonsterName[622] = "Golett";
this.MonsterName[623] = "Golurk";
this.MonsterName[624] = "Pawniard";
this.MonsterName[625] = "Bisharp";
this.MonsterName[626] = "Bouffalant";
this.MonsterName[627] = "Rufflet";
this.MonsterName[628] = "Braviary";
this.MonsterName[629] = "Vullaby";
this.MonsterName[630] = "Mandibuzz";
this.MonsterName[631] = "Heatmor";
this.MonsterName[632] = "Durant";
this.MonsterName[633] = "Deino";
this.MonsterName[634] = "Zweilous";
this.MonsterName[635] = "Hydreigon";
this.MonsterName[636] = "Larvesta";
this.MonsterName[637] = "Volcarona";
this.MonsterName[638] = "Cobalion";
this.MonsterName[639] = "Terrakion";
this.MonsterName[640] = "Virizion";
this.MonsterName[641] = "Tornadus";
this.MonsterName[642] = "Thundurus";
this.MonsterName[643] = "Reshiram";
this.MonsterName[644] = "Zekrom";
this.MonsterName[645] = "Landorus";
this.MonsterName[646] = "Kyurem";
this.MonsterName[647] = "Keldeo";
this.MonsterName[648] = "Meloetta";
this.MonsterName[649] = "Genesect";
this.MonsterName[650] = "Chespin";
this.MonsterName[651] = "Quilladin";
this.MonsterName[652] = "Chesnaught";
this.MonsterName[653] = "Fennekin";
this.MonsterName[654] = "Braixen";
this.MonsterName[655] = "Delphox";
this.MonsterName[656] = "Froakie";
this.MonsterName[657] = "Frogadier";
this.MonsterName[658] = "Greninja";
this.MonsterName[659] = "Bunnelby";
this.MonsterName[660] = "Diggersby";
this.MonsterName[661] = "Fletchling";
this.MonsterName[662] = "Fletchinder";
this.MonsterName[663] = "Talonflame";
this.MonsterName[664] = "Scatterbug";
this.MonsterName[665] = "Spewpa";
this.MonsterName[666] = "Vivillon";
this.MonsterName[667] = "Litleo";
this.MonsterName[668] = "Pyroar";
this.MonsterName[669] = "Flabebe";
this.MonsterName[670] = "Floette";
this.MonsterName[671] = "Florges";
this.MonsterName[672] = "Skiddo";
this.MonsterName[673] = "Gogoat";
this.MonsterName[674] = "Pancham";
this.MonsterName[675] = "Pangoro";
this.MonsterName[676] = "Furfrou";
this.MonsterName[677] = "Espurr";
this.MonsterName[678] = "Meowstic";
this.MonsterName[679] = "Honedge";
this.MonsterName[680] = "Doublade";
this.MonsterName[681] = "Aegislash";
this.MonsterName[682] = "Spritzee";
this.MonsterName[683] = "Aromatisse";
this.MonsterName[684] = "Swirlix";
this.MonsterName[685] = "Slurpuff";
this.MonsterName[686] = "Inkay";
this.MonsterName[687] = "Malamar";
this.MonsterName[688] = "Binacle";
this.MonsterName[689] = "Barbaracle";
this.MonsterName[690] = "Skrelp";
this.MonsterName[691] = "Dragalge";
this.MonsterName[692] = "Clauncher";
this.MonsterName[693] = "Clawitzer";
this.MonsterName[694] = "Helioptile";
this.MonsterName[695] = "Heliolisk";
this.MonsterName[696] = "Tyrunt";
this.MonsterName[697] = "Tyrantrum";
this.MonsterName[698] = "Amaura";
this.MonsterName[699] = "Aurorus";
this.MonsterName[700] = "Sylveon";
this.MonsterName[701] = "Hawlucha";
this.MonsterName[702] = "Dedenne";
this.MonsterName[703] = "Carbink";
this.MonsterName[704] = "Goomy";
this.MonsterName[705] = "Sliggoo";
this.MonsterName[706] = "Goodra";
this.MonsterName[707] = "Klefki";
this.MonsterName[708] = "Phantump";
this.MonsterName[709] = "Trevenant";
this.MonsterName[710] = "Pumpkaboo";
this.MonsterName[711] = "Gourgeist";
this.MonsterName[712] = "Bergmite";
this.MonsterName[713] = "Avalugg";
this.MonsterName[714] = "Noibat";
this.MonsterName[715] = "Noivern";
this.MonsterName[716] = "Xerneas";
this.MonsterName[717] = "Yveltal";
this.MonsterName[718] = "Zygarde";
this.MonsterName[719] = "Diancie";
this.MonsterName[720] = "Hoopa";
this.MonsterName[721] = "Volcanion";
this.MonsterName[722] = "Mega Fushigibana";
this.MonsterName[723] = "Mega Charizard X";
this.MonsterName[724] = "Mega Charizard Y";
this.MonsterName[725] = "Mega Blastoise";
this.MonsterName[726] = "Mega Alakazam";
this.MonsterName[727] = "Mega Gengar";
this.MonsterName[728] = "Mega Kangaskhan";
this.MonsterName[729] = "Mega Pinsir";
this.MonsterName[730] = "Mega Gyarados";
this.MonsterName[731] = "Mega Aerodactyl";
this.MonsterName[732] = "Mega Mewtwo X";
this.MonsterName[733] = "Mega Mewtwo Y";
this.MonsterName[734] = "Mega Ampharos";
this.MonsterName[735] = "Mega Scizor";
this.MonsterName[736] = "Mega Heracross";
this.MonsterName[737] = "Mega Houndoom";
this.MonsterName[738] = "Mega Tyranitar";
this.MonsterName[739] = "Mega Blaziken";
this.MonsterName[740] = "Mega Gardevoir";
this.MonsterName[741] = "Mega Mawile";
this.MonsterName[742] = "Mega Aggron";
this.MonsterName[743] = "Mega Medicham";
this.MonsterName[744] = "Mega Manectric";
this.MonsterName[745] = "Mega Banette";
this.MonsterName[746] = "Mega Absol";
this.MonsterName[747] = "Mega Garchomp";
this.MonsterName[748] = "Mega Lucario";
this.MonsterName[749] = "Mega Abomasnow";
this.MonsterName[750] = "Mega Beedrill";
this.MonsterName[751] = "Mega Pidgeot";
this.MonsterName[752] = "Mega Slowbro";
this.MonsterName[753] = "Mega Steelix";
this.MonsterName[754] = "Mega Sceptile";
this.MonsterName[755] = "Mega Swampert";
this.MonsterName[756] = "Mega Sableye";
this.MonsterName[757] = "Mega Sharpedo";
this.MonsterName[758] = "Mega Camerrupt";
this.MonsterName[759] = "Mega Altaria";
this.MonsterName[760] = "Mega Glalie";
this.MonsterName[761] = "Mega Salamence";
this.MonsterName[762] = "Mega Metagross";
this.MonsterName[763] = "Mega Latias";
this.MonsterName[764] = "Mega Latios";
this.MonsterName[765] = "Mega Rayquaza";
this.MonsterName[766] = "Mega Lopunny";
this.MonsterName[767] = "Mega Gallade";
this.MonsterName[768] = "Mega Audino";
this.MonsterName[769] = "Mega Diancie";
this.MonsterName[770] = "Primal Kyogre";
this.MonsterName[771] = "Primal Groudon";
this.MonsterName[772] = "SomePoke";
this.MonsterName[773] = "Mewtwo";
this.MonsterName[774] = "Crystal Onix";
this.MonsterName[775] = "XD001";
}
private void SetLang(string Language)
{
Language = "English";
this.Lang.setLanguage(Language);
PlayerPrefs.SetString("Lang", Language);
this.TranslateLabels[0].text = this.Lang.GetString("Copyright");
this.TranslateLabels[0].text = this.TranslateLabels[0].text.Replace("[N]", "\n");
this.TranslateLabels[1].text = this.Lang.GetString("Credits");
this.TranslateLabels[2].text = this.Lang.GetString("Login");
this.TranslateLabels[3].text = this.Lang.GetString("Login");
this.TranslateLabels[4].text = this.Lang.GetString("Remember_Pass");
this.TranslateLabels[7].text = this.Lang.GetString("Options");
this.TranslateLabels[8].text = this.Lang.GetString("Quit");
this.TranslateLabels[9].text = this.Lang.GetString("Resolution");
this.TranslateLabels[10].text = this.Lang.GetString("Options");
this.TranslateLabels[11].text = this.Lang.GetString("Apply");
this.TranslateLabels[12].text = this.Lang.GetString("Cancel");
this.TranslateLabels[13].text = this.Lang.GetString("Fullscreen");
this.TranslateLabels[14].text = this.Lang.GetString("View_Size");
this.TranslateLabels[16].text = this.Lang.GetString("Okay");
this.TranslateLabels[21].text = this.Lang.GetString("Main_Menu");
this.TranslateLabels[22].text = this.Lang.GetString("Return");
this.TranslateLabels[23].text = this.Lang.GetString("Options");
this.TranslateLabels[24].text = this.Lang.GetString("Logout");
this.TranslateLabels[25].text = this.Lang.GetString("FList");
this.TranslateLabels[26].text = this.Lang.GetString("Battle");
this.TranslateLabels[27].text = this.Lang.GetString("Trade");
this.TranslateLabels[28].text = this.Lang.GetString("Message");
this.TranslateLabels[29].text = this.Lang.GetString("Friend");
this.TranslateLabels[30].text = this.Lang.GetString("Weather");
this.TranslateLabels[31].text = this.Lang.GetString("Fight");
this.TranslateLabels[32].text = this.Lang.GetString("Run");
this.TranslateLabels[33].text = this.Lang.GetString("Items");
this.TranslateLabels[34].text = this.Lang.GetString("GUIScale");
this.TranslateLabels[35].text = this.Lang.GetString("Lighting");
this.chatBox.defaultText = this.Lang.GetString("EnterToChat");
this.TranslateTips[1].ToSay = "[33CCFF]" + this.Lang.GetString("Main_Menu") + "[-]";
this.TranslateTips[2].ToSay = "[33CCFF]" + this.Lang.GetString("PMoney") + "[-]";
this.TranslateTips[3].ToSay = "[33CCFF]" + this.Lang.GetString("HSChat") + "[-]";
this.TranslateTips[4].ToSay = "[33CCFF]" + this.Lang.GetString("UItems") + "[-]";
this.TranslateTips[5].ToSay = "[33CCFF]" + this.Lang.GetString("Potions") + "[-]";
this.TranslateTips[6].ToSay = "[33CCFF]" + this.Lang.GetString("Key_Items") + "[-]";
this.TranslateTips[7].ToSay = "[33CCFF]" + this.Lang.GetString("Trash") + "[-] - " + this.Lang.GetString("TrashDesc");
if (Language == "English")
{
this.FlagFist.mainTexture = this.FistTexture[0];
}
else if (Language == "German")
{
this.FlagFist.mainTexture = this.FistTexture[1];
}
else if (Language == "Croatian")
{
this.FlagFist.mainTexture = this.FistTexture[2];
}
else if (Language == "Russian")
{
this.FlagFist.mainTexture = this.FistTexture[3];
}
else if (Language == "Spanish")
{
this.FlagFist.mainTexture = this.FistTexture[4];
}
else if (Language == "Italian")
{
this.FlagFist.mainTexture = this.FistTexture[5];
}
else if (Language == "Portuguese-BR")
{
this.FlagFist.mainTexture = this.FistTexture[6];
}
else if (Language == "Hungary")
{
this.FlagFist.mainTexture = this.FistTexture[7];
}
else if (Language == "Portuguese")
{
this.FlagFist.mainTexture = this.FistTexture[8];
}
else if (Language == "French")
{
this.FlagFist.mainTexture = this.FistTexture[9];
}
}
private void Start()
{
SHDE.PROSD();
this.SavedChat = new List<DSSock.SavedChats>();
this.TextFiler = base.GetComponent<SwearFilter>();
this.TI = new TileInfo();
this.TI.LoadInfo();
this.Lang = new Language();
this.Lang.SetEnglish();
this.SetLang(PlayerPrefs.GetString("Lang", "English"));
this.con.Add("PRO> PRO Starting Up.");
this.Atks = new Attacks();
this.Atks.LoadMoves();
this.Itms = new ItemDes();
this.Itms.LoadItems(PlayerPrefs.GetString("Lang", "English"));
this.loadTiles();
this.ClearVaribles();
this.PlayMusic(0);
if (PlayerPrefs.GetInt("remember") == 1)
{
this.rememberPass.value = true;
}
else
{
this.rememberPass.value = false;
}
if (this.rememberPass.value)
{
this.user.value = PlayerPrefs.GetString("UserName", string.Empty);
this.pass.value = PlayerPrefs.GetString("PassWord", string.Empty);
}
this.Players.sprite = "11000000000";
this.AF.MS = this.MS;
this.setSheet();
Camera.main.orthographicSize = 5f;
}
private void PlayMusic(int ID)
{
this.musicPlayer.PlayMusic(ID);
}
private void ClearVaribles()
{
this.ChatText.Clear();
}
private void sendMove(string dir)
{
this.sendPacket("}|.|" + dir);
this.lastMoved = Time.time;
this.dontChange = false;
this.FollowPoke.LastPostion = this.Player.position;
if (this.mapCreator.Colliders[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)] == 5)
{
return;
}
if (this.mapCreator.Tiles4[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)] == 25105 || this.mapCreator.Tiles4[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)] == 25106 || this.mapCreator.Tiles4[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)] == 25107)
{
return;
}
if (!this.Bike && (this.CanFootStep(this.mapCreator.Tiles[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)]) || this.CanFootStep(this.mapCreator.Tiles2[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)]) || this.CanFootStep(this.mapCreator.Tiles3[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)])))
{
FootStep footStep = UnityEngine.Object.Instantiate(this.FSObject, this.Player.position + new Vector3(0f, 0.5f, 0.01f), Quaternion.identity) as FootStep;
this.stepCount++;
if (this.stepCount > 3)
{
this.stepCount = 0;
}
if (this.stepCount == 0)
{
this.stepCount2 = 0;
}
if (this.stepCount == 1)
{
this.stepCount2 = 1;
}
if (this.stepCount == 2)
{
this.stepCount2 = 2;
}
if (this.stepCount == 3)
{
this.stepCount2 = 1;
}
switch (this.pDirection)
{
case 1:
footStep.ChangeSprite(0 + this.stepCount2);
break;
case 2:
footStep.ChangeSprite(6 + this.stepCount2);
break;
case 3:
footStep.ChangeSprite(9 + this.stepCount2);
break;
case 4:
footStep.ChangeSprite(3 + this.stepCount2);
break;
}
}
else if (this.Bike && !this.AF.Mount && (this.CanFootStep(this.mapCreator.Tiles[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)]) || this.CanFootStep(this.mapCreator.Tiles2[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)]) || this.CanFootStep(this.mapCreator.Tiles3[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)])))
{
FootStep footStep2 = UnityEngine.Object.Instantiate(this.BikeStepObject, this.Player.position + new Vector3(0f, 0f, 0.01f), Quaternion.identity) as FootStep;
switch (this.pDirection)
{
case 1:
if (dir == "u")
{
footStep2.ChangeSprite(3);
}
if (dir == "d")
{
footStep2.ChangeSprite(3);
}
if (dir == "l")
{
footStep2.ChangeSprite(2);
}
if (dir == "r")
{
footStep2.ChangeSprite(0);
}
break;
case 2:
if (dir == "u")
{
footStep2.ChangeSprite(3);
}
if (dir == "d")
{
footStep2.ChangeSprite(3);
}
if (dir == "l")
{
footStep2.ChangeSprite(7);
}
if (dir == "r")
{
footStep2.ChangeSprite(5);
}
break;
case 3:
if (dir == "u")
{
footStep2.ChangeSprite(5);
}
if (dir == "d")
{
footStep2.ChangeSprite(0);
}
if (dir == "l")
{
footStep2.ChangeSprite(1);
}
if (dir == "r")
{
footStep2.ChangeSprite(1);
}
break;
case 4:
if (dir == "u")
{
footStep2.ChangeSprite(7);
}
if (dir == "d")
{
footStep2.ChangeSprite(2);
}
if (dir == "l")
{
footStep2.ChangeSprite(1);
}
if (dir == "r")
{
footStep2.ChangeSprite(1);
}
break;
}
}
}
public void createFootStep(int x, int y, float z, int ani, int dir)
{
if (this.mapCreator.Colliders[x, y] == 5)
{
return;
}
if (this.mapCreator.Tiles4[x, y] == 25105 || this.mapCreator.Tiles4[x, y] == 25106 || this.mapCreator.Tiles4[x, y] == 25107)
{
return;
}
if (this.CanFootStep(this.mapCreator.Tiles[x, y]) || this.CanFootStep(this.mapCreator.Tiles2[x, y]) || this.CanFootStep(this.mapCreator.Tiles3[x, y]))
{
FootStep footStep = UnityEngine.Object.Instantiate(this.FSObject, new Vector3((float)x, (float)(-(float)y) + 0.5f, z), Quaternion.identity) as FootStep;
footStep.ChangeSprite(dir + ani);
}
}
public void createBikeStep(int x, int y, float z, int ani, string dir, int newdir)
{
if (this.mapCreator.Colliders[x, y] == 5)
{
return;
}
if (this.CanFootStep(this.mapCreator.Tiles[x, y]) || this.CanFootStep(this.mapCreator.Tiles2[x, y]) || this.CanFootStep(this.mapCreator.Tiles3[x, y]))
{
FootStep footStep = UnityEngine.Object.Instantiate(this.BikeStepObject, new Vector3((float)x, (float)(-(float)y), z), Quaternion.identity) as FootStep;
switch (newdir)
{
case 1:
if (dir == "u")
{
footStep.ChangeSprite(3);
}
if (dir == "d")
{
footStep.ChangeSprite(3);
}
if (dir == "l")
{
footStep.ChangeSprite(2);
}
if (dir == "r")
{
footStep.ChangeSprite(0);
}
break;
case 2:
if (dir == "u")
{
footStep.ChangeSprite(3);
}
if (dir == "d")
{
footStep.ChangeSprite(3);
}
if (dir == "l")
{
footStep.ChangeSprite(7);
}
if (dir == "r")
{
footStep.ChangeSprite(5);
}
break;
case 3:
if (dir == "u")
{
footStep.ChangeSprite(5);
}
if (dir == "d")
{
footStep.ChangeSprite(0);
}
if (dir == "l")
{
footStep.ChangeSprite(1);
}
if (dir == "r")
{
footStep.ChangeSprite(1);
}
break;
case 4:
if (dir == "u")
{
footStep.ChangeSprite(7);
}
if (dir == "d")
{
footStep.ChangeSprite(2);
}
if (dir == "l")
{
footStep.ChangeSprite(1);
}
if (dir == "r")
{
footStep.ChangeSprite(1);
}
break;
}
}
}
private bool CanFootStep(int Tile)
{
switch (Tile)
{
case 1403:
case 1404:
case 1411:
case 1412:
case 1419:
case 1420:
case 1427:
case 1428:
case 1432:
case 1433:
case 1434:
case 1435:
case 1436:
case 1437:
case 1440:
case 1441:
case 1442:
case 1443:
case 1444:
case 1445:
case 1448:
case 1449:
case 1450:
case 1451:
case 1452:
case 1453:
return true;
case 1405:
case 1406:
case 1407:
case 1408:
case 1409:
case 1410:
case 1413:
case 1414:
case 1415:
case 1416:
case 1417:
case 1418:
case 1421:
case 1422:
case 1423:
case 1424:
case 1425:
case 1426:
case 1429:
case 1430:
case 1431:
case 1438:
case 1439:
case 1446:
case 1447:
IL_DA:
switch (Tile)
{
case 1912:
case 1913:
case 1914:
case 1920:
case 1921:
case 1922:
case 1923:
case 1924:
case 1928:
case 1929:
case 1930:
case 1936:
case 1937:
case 1938:
case 1939:
case 1940:
case 1944:
case 1945:
case 1946:
case 1947:
case 1948:
case 1952:
case 1953:
case 1954:
return true;
case 1915:
case 1916:
case 1917:
case 1918:
case 1919:
case 1925:
case 1926:
case 1927:
case 1931:
case 1932:
case 1933:
case 1934:
case 1935:
case 1941:
case 1942:
case 1943:
case 1949:
case 1950:
case 1951:
IL_192:
switch (Tile)
{
case 1478:
case 1479:
case 1483:
case 1484:
case 1485:
case 1491:
case 1492:
case 1493:
return true;
case 1480:
case 1481:
case 1482:
case 1486:
case 1487:
case 1488:
case 1489:
case 1490:
IL_1DE:
switch (Tile)
{
case 6309:
case 6310:
case 6311:
case 6317:
case 6318:
case 6319:
return true;
case 6312:
case 6313:
case 6314:
case 6315:
case 6316:
IL_216:
switch (Tile)
{
case 6325:
case 6326:
case 6327:
case 6333:
case 6334:
case 6335:
return true;
case 6328:
case 6329:
case 6330:
case 6331:
case 6332:
IL_24E:
switch (Tile)
{
case 8280:
case 8281:
case 8282:
case 8288:
case 8289:
case 8290:
return true;
case 8283:
case 8284:
case 8285:
case 8286:
case 8287:
IL_286:
switch (Tile)
{
case 1499:
case 1500:
case 1501:
return true;
default:
switch (Tile)
{
case 8272:
case 8274:
return true;
case 8273:
IL_2B6:
switch (Tile)
{
case 8296:
case 8297:
case 8298:
return true;
default:
switch (Tile)
{
case 8304:
case 8306:
return true;
case 8305:
IL_2E6:
if (Tile != 1470 && Tile != 1471 && Tile != 6301 && Tile != 6302 && Tile != 2313)
{
return false;
}
return true;
}
goto IL_2E6;
}
break;
}
goto IL_2B6;
}
break;
}
goto IL_286;
}
goto IL_24E;
}
goto IL_216;
}
goto IL_1DE;
}
goto IL_192;
}
goto IL_DA;
}
public void sendMSG(string text)
{
this.sendPacket("{|.|" + text);
}
public string AsciiToUNI(string text)
{
byte[] bytes = Encoding.ASCII.GetBytes(text);
for (int i = 0; i < bytes.Length; i++)
{
if (bytes[i] == 1)
{
bytes[i] = 0;
}
}
text = Encoding.Unicode.GetString(bytes);
return text;
}
private void DirectionToSprite()
{
if (this.pDirection == 0)
{
this.pDirection = 1;
}
switch (this.pDirection)
{
case 1:
this.AF.ChangeSprite(0 + this.LAniNumber);
break;
case 2:
this.AF.ChangeSprite(6 + this.LAniNumber);
break;
case 3:
this.AF.ChangeSprite(9 + this.LAniNumber);
break;
case 4:
this.AF.ChangeSprite(3 + this.LAniNumber);
break;
}
}
private void setSheet()
{
string ext = string.Empty;
if (this.Surf)
{
ext = "sf";
}
if (this.Bike)
{
ext = "b";
}
if (this.Bike || this.Surf)
{
this.FollowPoke.gameObject.SetActive(false);
}
else if (!this.FollowPoke.gameObject.activeSelf)
{
this.FollowPoke.gameObject.SetActive(true);
this.FollowPoke.transform.position = this.Player.position + new Vector3(0f, 1f, 0f);
this.FollowPoke.LastPostion = this.Player.position + new Vector3(0f, 1f, 0f);
}
this.AF.ChangeSheet(this.Players.sprite, ext);
}
private void createAni()
{
int num = this.mapCreator.Tiles2[(int)this.Player.position.x, -(int)this.Player.position.y];
int num2 = this.mapCreator.Tiles3[(int)this.Player.position.x, -(int)this.Player.position.y];
if (num == 6 || num == 14 || num == 55 || num == 15 || num == 248 || num == 249 || num == 250 || num2 == 6 || num2 == 14 || num2 == 55 || num2 == 15 || num2 == 248 || num2 == 249 || num2 == 250)
{
UnityEngine.Object.Instantiate(this.GrassObject, this.Player.position, Quaternion.identity);
AudioSource.PlayClipAtPoint(this.GrassSound, Camera.main.transform.position, this.SFXVolume);
}
}
public void createNetworkAni(int x, int y, float z)
{
if (y < 1)
{
return;
}
if (y > this.mapCreator.Height - 1)
{
return;
}
if (x > this.mapCreator.Width - 1)
{
return;
}
if (x < 1)
{
return;
}
int num = this.mapCreator.Tiles2[x, y + 1];
int num2 = this.mapCreator.Tiles3[x, y + 1];
if (num == 6 || num == 14 || num == 55 || num == 15 || num == 248 || num == 249 || num == 250 || num2 == 6 || num2 == 14 || num2 == 55 || num2 == 15 || num2 == 248 || num2 == 249 || num2 == 250)
{
UnityEngine.Object.Instantiate(this.GrassObject, new Vector3((float)x, (float)(-(float)(y + 1)), z), Quaternion.identity);
}
}
private void FixedUpdate()
{
if (this.LoggedIn && Time.time > this.LastTimeTextUpdate + 10f)
{
this.LastTimeTextUpdate = Time.time;
this.TimeLabel.text = DateTime.Now.ToString("HH:mm") + "\n" + this.PokeTime;
}
}
public void RemoveHat()
{
if (this.Wearables[1].mainTexture != null)
{
this.sendMSG("/takehat");
}
}
public void RemoveClothe()
{
if (this.Wearables[2].mainTexture != null)
{
this.sendMSG("/takecloth");
}
}
public void SetChar(string Hair, string Colour, string Tone, string Clothe, string Eyes)
{
this.sendMSG(string.Concat(new string[]
{
"/setchar ",
Hair,
",",
Colour,
",",
Tone,
",",
Clothe,
",",
Eyes
}));
this.StartStage++;
this.UpdateBox = true;
this.TownButtons.SetActive(false);
}
private void Update()
{
if (Input.GetKeyUp(this.toggleKey))
{
this.Console.SetActive(!this.Console.activeSelf);
if (this.Console.activeSelf)
{
this.ConText.isSelected = true;
}
}
if (this.toDiscon)
{
this.Disconnect();
return;
}
this.processReadBuffers();
if (this.loadingMap)
{
return;
}
if (!this.LoggedIn)
{
if (this.Message != this.res)
{
this.Message = this.res;
this.MessageTime = 5f;
}
this.MessageTime += -1f * Time.deltaTime;
if (this.MessageTime < 0f)
{
this.MessageTime = 0f;
this.Message = string.Empty;
this.res = string.Empty;
}
}
if (this.LoggedIn)
{
if (!this.isConnected)
{
this.toDiscon = true;
return;
}
if (this.StartScreen.activeSelf && this.tosay != string.Empty)
{
if (this.CanPressKey && !this.TownButtons.activeSelf && (Input.GetKeyUp(this.KeyManager.InteractButton) || Input.GetKeyUp(this.KeyManager.InteractButtonS) || Input.GetMouseButtonDown(0)))
{
this.UpdateBox = true;
}
if (this.Scrolling && this.tosay != string.Empty)
{
this.StartText.text = this.tosay.Substring(0, this.ScrollTo) + " ";
this.scrollCount += this.SaySpeed * Time.deltaTime;
if (this.scrollCount > 1f)
{
this.ScrollTo++;
this.scrollCount = 0f;
}
if (this.ScrollTo > this.tosay.Length)
{
AudioSource.PlayClipAtPoint(this.TextSound, Camera.main.transform.position, this.SFXVolume);
this.ScrollTo = this.tosay.Length;
this.Scrolling = false;
this.StartText.text = this.tosay;
this.scrollCount = 0f;
}
else if (this.UpdateBox)
{
this.UpdateBox = false;
this.ScrollTo = this.tosay.Length;
return;
}
}
if (this.UpdateBox)
{
this.UpdateBox = false;
this.Scrolling = true;
this.ScrollTo = 0;
if (this.StartStage == 0)
{
this.StartStage++;
this.StartText.text = string.Empty;
this.tosay = "But everyone calls me the Pokemon\nProfessor.";
return;
}
if (this.StartStage == 1)
{
this.StartStage++;
this.StartText.text = string.Empty;
this.tosay = "Before we go any further, I'd like to tell\nyou a few things you should know about\nthis world!";
return;
}
if (this.StartStage == 2)
{
this.StartStage++;
this.StartText.text = string.Empty;
this.tosay = "This world is widely inhabited by\ncreatures known as Pokemon.\n\nWe humans live alongside Pokemon\nas friends.\n";
return;
}
if (this.StartStage == 3)
{
this.StartStage++;
this.StartText.text = string.Empty;
this.tosay = "At times we play together, and at other\ntimes we work together.\n\nSome people use their Pokemon to\nbattle and develop closer bonds with\nthem..\n";
return;
}
if (this.StartStage == 4)
{
this.StartStage++;
this.StartText.text = string.Empty;
this.tosay = "Now, why don't you tell me a little bit\nabout yourself?";
return;
}
if (this.StartStage == 5)
{
this.StartStage++;
this.StartText.text = string.Empty;
this.tosay = "Are you a Boy or Girl?";
this.TownButtons.SetActive(true);
return;
}
if (this.StartStage == 6)
{
this.StartStage++;
this.StartText.text = string.Empty;
this.tosay = "Are you ready?\n\nYour very own tale of grand adventure is\nabout to unfold.\n";
return;
}
if (this.StartStage == 7)
{
this.StartStage++;
this.StartText.text = string.Empty;
this.tosay = "Fun experiences, difficult experiences,\nthere's so much waiting for you!\n\nDreams! Adventure!\n\nLet's go to the world of Pokemon!";
return;
}
if (this.StartStage == 8)
{
this.StartStage = 0;
this.StartText.text = string.Empty;
this.tosay = string.Empty;
this.StartScreen.SetActive(false);
this.PlayMusic(this.mapMusic);
return;
}
}
return;
}
if (this.CanPressKey && Input.GetKeyUp(KeyCode.Escape))
{
this.chatBox.RemoveFocus();
this.openMenu();
}
if (this.inBattle)
{
this.BattleLoop();
}
else if (this.movetomap != string.Empty)
{
this.MoveUser(this.movetomap, this.movetox, this.movetoy, this.movetosurf);
this.movetomap = string.Empty;
this.movetox = 0;
this.movetoy = 0;
this.movetosurf = 0;
}
if (this.FriendSprite.alpha > 0f)
{
this.FriendSprite.alpha += -0.8f * Time.deltaTime;
}
this.HandleQue();
this.FadeLight();
this.chatOpen = this.chatBox.isSelected;
if (!this.chatOpen)
{
if (UICamera.selectedObject)
{
if (UICamera.selectedObject.name == "PMInput")
{
this.chatOpen = true;
}
else if (UICamera.selectedObject.name == "ChannelText")
{
this.chatOpen = true;
}
else if (UICamera.selectedObject.name == "Search")
{
this.chatOpen = true;
}
else if (UICamera.selectedObject.name == "ReportInput")
{
this.chatOpen = true;
}
else if (UICamera.selectedObject.name == "SearchBox")
{
this.chatOpen = true;
}
}
if (this.menuGUI.activeSelf || this.optionsGUI.activeSelf)
{
this.chatOpen = true;
}
}
Vector3 position = this.Player.position;
position.z = -(-position.y / 30000f);
if (!this.OnGround)
{
position.z += -6f;
}
this.Player.position = position;
position = this.newPos;
position.z = -(-position.y / 30000f);
if (!this.OnGround)
{
position.z += -6f;
}
this.newPos = position;
if (this.messageTimer > 0f)
{
this.messageTimer += -1f * Time.deltaTime;
this.MText.color = new Color(1f, 1f, 1f, this.messageTimer);
this.MText.text = this.messageText;
}
if (this.messageTimer < 0f)
{
this.MText.gameObject.SetActive(false);
this.messageTimer = 0f;
this.messageText = string.Empty;
}
if (!this.ssh && Time.timeScale != 1f)
{
this.ssh = true;
this.sendPacket("ah");
}
if (Time.time > this.lastMoved + 10f)
{
this.lastMoved = Time.time;
this.sendPacket("2");
}
if (!this.dontChange && Time.time > this.lastMoved + 1f)
{
this.dontChange = true;
this.LAniNumber = 1;
switch (this.pDirection)
{
case 1:
this.AF.ChangeSprite(0 + this.LAniNumber);
break;
case 2:
this.AF.ChangeSprite(6 + this.LAniNumber);
break;
case 3:
this.AF.ChangeSprite(9 + this.LAniNumber);
break;
case 4:
this.AF.ChangeSprite(3 + this.LAniNumber);
break;
}
}
if (this.bSync)
{
this.canMove = false;
this.isMovable = true;
}
else
{
this.canMove = true;
}
if (!this.MessageStuck && !this.ScriptPause)
{
if (!this.isMovable)
{
this.Player.position = Vector3.MoveTowards(this.Player.position, this.newPos, this.MoveSpeed * Time.deltaTime);
if (this.Player.position == this.newPos)
{
this.FollowPoke.OnTop(this.OnGround);
this.Player.position = new Vector3((float)Math.Round((double)this.Player.position.x), (float)Math.Round((double)this.Player.position.y), this.Player.position.z);
this.isMovable = true;
this.createAni();
if (this.CanMove)
{
int num = this.NPCLOS(0);
if (num > 0)
{
if (this.inBattle)
{
return;
}
if (this.inTrade)
{
return;
}
this.LockPlayer();
cNPC component = this.NPCS[num - 1].GetComponent<cNPC>();
component.waitmove = -100f;
component.QUE.Clear();
component.SetLOSActive(this.NPCVect);
}
}
if (this.MovePos.Count > 0)
{
this.newPos = this.Player.position;
if (this.MovePos[0] == "0")
{
this.newPos.y = this.newPos.y + 1f;
this.sendMove("u");
}
if (this.MovePos[0] == "1")
{
this.newPos.x = this.newPos.x + 1f;
this.sendMove("r");
}
if (this.MovePos[0] == "2")
{
this.newPos.y = this.newPos.y + -1f;
this.sendMove("d");
}
if (this.MovePos[0] == "3")
{
this.newPos.x = this.newPos.x + -1f;
this.sendMove("l");
}
this.isMovable = false;
List<string> movePos = this.MovePos;
lock (movePos)
{
this.MovePos.RemoveAt(0);
}
}
else if (this.NPCMoveID != string.Empty)
{
this.MessageStuck = true;
this.sendPacket("N|.|" + this.NPCMoveID);
this.NPCMoveID = string.Empty;
}
}
else
{
if (this.Bike)
{
this.AniSpeed = 70f;
}
else
{
this.AniSpeed = 60f;
}
this.AniTimer += this.AniSpeed * Time.deltaTime;
if (this.AniTimer >= 10f)
{
this.AniNumber++;
this.AniTimer = 0f;
if (this.AniNumber > 3)
{
this.AniNumber = 0;
}
if (this.AniNumber == 0)
{
this.LAniNumber = 0;
}
if (this.AniNumber == 1)
{
this.LAniNumber = 1;
}
if (this.AniNumber == 2)
{
this.LAniNumber = 2;
}
if (this.AniNumber == 3)
{
this.LAniNumber = 1;
}
if (this.Slide == 0)
{
if (this.newPos.x > this.Player.position.x)
{
this.AF.ChangeSprite(3 + this.LAniNumber);
}
if (this.newPos.x < this.Player.position.x)
{
this.AF.ChangeSprite(9 + this.LAniNumber);
}
if (this.newPos.y > this.Player.position.y)
{
this.AF.ChangeSprite(0 + this.LAniNumber);
}
if (this.newPos.y < this.Player.position.y)
{
this.AF.ChangeSprite(6 + this.LAniNumber);
}
}
else
{
this.AF.ChangeSprite(3 * this.AniNumber);
}
}
}
}
if (!Input.anyKey)
{
this.keyLock = false;
}
if (!this.GLM.EditPanel.activeSelf && !this.SM.ShopWindow.activeSelf && this.canMove && this.isMovable && this.CanMove && !this.NPCLock && !this.inTrade && !this.inBattle && !this.Evolving && !this.Console.activeSelf && !this.keyLock && !this.PCBox.activeSelf && !this.MR.LearnWindow.activeSelf && !this.ER.LearnWindow.activeSelf)
{
this.newPos = this.Player.position;
if (this.CanPressKey)
{
if (this.ControllerOn.value)
{
if (Input.GetAxis("Horizontal") > 0.99f)
{
this.moveRight = true;
this.moveLeft = false;
this.moveUp = false;
this.moveDown = false;
}
else if (Input.GetAxis("Horizontal") < -0.99f)
{
this.moveLeft = true;
this.moveRight = false;
this.moveUp = false;
this.moveDown = false;
}
else
{
this.moveLeft = false;
this.moveRight = false;
}
if (Input.GetAxis("Vertical") > 0.99f)
{
this.moveUp = false;
this.moveDown = true;
this.moveLeft = false;
this.moveRight = false;
}
else if (Input.GetAxis("Vertical") < -0.99f)
{
this.moveUp = true;
this.moveDown = false;
this.moveLeft = false;
this.moveRight = false;
}
else
{
this.moveUp = false;
this.moveDown = false;
}
}
else
{
this.moveUp = false;
this.moveDown = false;
this.moveLeft = false;
this.moveRight = false;
}
}
if (-((int)this.newPos.y + 1) > -1 && ((((this.CanPressKey && (Input.GetKey(this.KeyManager.UpButton) || Input.GetKey(this.KeyManager.UpButtonS)) && !this.chatOpen) || this.smoveUp || this.moveUp) && this.Slide == 0) || this.IceUp || this.Slide == 1) && this.isMovable && !this.IceDown && !this.IceRight && !this.IceLeft)
{
int num2 = this.mapCreator.Colliders[(int)this.newPos.x, -((int)this.newPos.y + 1)];
if (-(int)this.newPos.y > this.mapCreator.Height || this.mapCreator.Colliders[(int)this.newPos.x, -(int)this.newPos.y] != 14)
{
if (this.OnGround)
{
if (num2 == 14 || num2 == 0 || num2 == 6 || num2 == 7 || num2 == 8 || num2 == 9 || ((num2 == 5 || num2 == 12) && this.Surf))
{
if (!this.NPCat((int)this.newPos.x, -((int)this.newPos.y + 1)))
{
if (num2 != 5 && num2 != 12 && this.Surf)
{
this.Surf = false;
this.setSheet();
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
}
if (num2 == 7)
{
this.OnGround = false;
}
if (num2 == 8)
{
this.OnGround = true;
}
this.newPos.y = this.newPos.y + 1f;
this.sendMove("u");
this.isMovable = false;
if (this.GetIce((int)this.newPos.x, -(int)this.newPos.y))
{
this.IceUp = true;
this.IceDown = false;
this.IceRight = false;
this.IceLeft = false;
}
else
{
this.IceUp = false;
}
int slide = this.GetSlide((int)this.newPos.x, -(int)this.newPos.y);
if (slide > 0)
{
this.Slide = slide;
if (this.Slide == 5)
{
this.Slide = 0;
}
}
}
}
else
{
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
this.IceUp = false;
this.Slide = 0;
this.PlayBump();
}
}
else if (num2 == 14 || num2 == 7 || num2 == 8 || num2 == 9 || num2 == 10 || num2 == 12)
{
if (!this.NPCat((int)this.newPos.x, -((int)this.newPos.y + 1)))
{
if (num2 == 8)
{
this.OnGround = true;
}
this.Surf = false;
this.newPos.y = this.newPos.y + 1f;
this.sendMove("u");
this.isMovable = false;
}
}
else
{
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
this.IceUp = false;
this.Slide = 0;
this.PlayBump();
}
}
if (this.pDirection != 1)
{
this.pDirection = 1;
this.DirectionToSprite();
}
this.pDirection = 1;
return;
}
if (-(int)this.newPos.y < this.mapCreator.Height && ((((this.CanPressKey && (Input.GetKey(this.KeyManager.DownButton) || Input.GetKey(this.KeyManager.DownButtonS)) && !this.chatOpen) || this.smoveDown || this.moveDown) && this.Slide == 0) || this.IceDown || this.Slide == 2) && this.isMovable && !this.IceUp && !this.IceRight && !this.IceLeft)
{
int num2 = this.mapCreator.Colliders[(int)this.newPos.x, -((int)this.newPos.y - 1)];
if (this.OnGround)
{
if (num2 == 0 || num2 == 6 || num2 == 7 || num2 == 8 || num2 == 9 || ((num2 == 5 || num2 == 12) && this.Surf))
{
if (!this.NPCat((int)this.newPos.x, -((int)this.newPos.y - 1)))
{
if (num2 != 5 && num2 != 12 && this.Surf)
{
this.Surf = false;
this.setSheet();
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
}
if (num2 == 7)
{
this.OnGround = false;
}
if (num2 == 8)
{
this.OnGround = true;
}
this.newPos.y = this.newPos.y + -1f;
this.sendMove("d");
this.isMovable = false;
if (this.GetIce((int)this.newPos.x, -(int)this.newPos.y))
{
this.IceDown = true;
this.IceUp = false;
this.IceRight = false;
this.IceLeft = false;
}
else
{
this.IceDown = false;
}
int slide2 = this.GetSlide((int)this.newPos.x, -(int)this.newPos.y);
if (slide2 > 0)
{
this.Slide = slide2;
if (this.Slide == 5)
{
this.Slide = 0;
}
}
}
}
else if (num2 == 2)
{
this.PlayerJump.Jump();
this.newPos.y = this.newPos.y + -2f;
this.sendMove("d");
this.isMovable = false;
}
else
{
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
this.IceDown = false;
this.Slide = 0;
this.PlayBump();
}
}
else if (num2 == 7 || num2 == 8 || num2 == 9 || num2 == 10 || num2 == 12)
{
if (!this.NPCat((int)this.newPos.x, -((int)this.newPos.y - 1)))
{
if (num2 == 8)
{
this.OnGround = true;
}
this.Surf = false;
this.newPos.y = this.newPos.y + -1f;
this.sendMove("d");
this.isMovable = false;
}
}
else
{
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
this.IceDown = false;
this.Slide = 0;
this.PlayBump();
}
if (this.pDirection != 2)
{
this.pDirection = 2;
this.DirectionToSprite();
}
this.pDirection = 2;
return;
}
if ((int)this.newPos.x > 0 && ((((this.CanPressKey && (Input.GetKey(this.KeyManager.LeftButton) || Input.GetKey(this.KeyManager.LeftButtonS)) && !this.chatOpen) || this.smoveLeft || this.moveLeft) && this.Slide == 0) || this.IceLeft || this.Slide == 3) && this.isMovable && !this.IceDown && !this.IceRight && !this.IceUp)
{
int num2 = this.mapCreator.Colliders[(int)this.newPos.x - 1, -(int)this.newPos.y];
if (this.OnGround)
{
if (num2 == 14 || num2 == 0 || num2 == 6 || num2 == 7 || num2 == 8 || num2 == 9 || ((num2 == 5 || num2 == 12) && this.Surf))
{
if (!this.NPCat((int)this.newPos.x - 1, -(int)this.newPos.y))
{
if (num2 != 5 && num2 != 12 && this.Surf)
{
this.Surf = false;
this.setSheet();
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
}
if (num2 == 7)
{
this.OnGround = false;
}
if (num2 == 8)
{
this.OnGround = true;
}
this.newPos.x = this.newPos.x + -1f;
this.sendMove("l");
this.isMovable = false;
if (this.GetIce((int)this.newPos.x, -(int)this.newPos.y))
{
this.IceLeft = true;
this.IceUp = false;
this.IceDown = false;
this.IceRight = false;
}
else
{
this.IceLeft = false;
}
int slide3 = this.GetSlide((int)this.newPos.x, -(int)this.newPos.y);
if (slide3 > 0)
{
this.Slide = slide3;
if (this.Slide == 5)
{
this.Slide = 0;
}
}
}
}
else if (num2 == 4)
{
this.PlayerJump.Jump();
this.newPos.x = this.newPos.x + -2f;
this.sendMove("l");
this.isMovable = false;
}
else
{
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
this.IceLeft = false;
this.Slide = 0;
this.PlayBump();
}
}
else if (num2 == 14 || num2 == 7 || num2 == 8 || num2 == 9 || num2 == 10 || num2 == 12)
{
if (!this.NPCat((int)this.newPos.x - 1, -(int)this.newPos.y))
{
if (num2 == 8)
{
this.OnGround = true;
}
this.Surf = false;
this.newPos.x = this.newPos.x + -1f;
this.sendMove("l");
this.isMovable = false;
}
}
else
{
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
this.IceLeft = false;
this.Slide = 0;
this.PlayBump();
}
if (this.pDirection != 3)
{
this.pDirection = 3;
this.DirectionToSprite();
}
this.pDirection = 3;
return;
}
if (((this.CanPressKey && (Input.GetKey(this.KeyManager.RightButton) || Input.GetKey(this.KeyManager.RightButtonS)) && !this.chatOpen) || ((this.moveRight || this.smoveRight) && this.Slide == 0) || this.IceRight || this.Slide == 4) && this.isMovable && (int)this.newPos.x < this.mapCreator.Width && !this.IceDown && !this.IceUp && !this.IceLeft)
{
int num2 = this.mapCreator.Colliders[(int)this.newPos.x + 1, -(int)this.newPos.y];
if (this.OnGround)
{
if (num2 == 14 || num2 == 0 || num2 == 6 || num2 == 7 || num2 == 8 || num2 == 9 || ((num2 == 5 || num2 == 12) && this.Surf))
{
if (!this.NPCat((int)this.newPos.x + 1, -(int)this.newPos.y))
{
if (num2 != 5 && num2 != 12 && this.Surf)
{
this.Surf = false;
this.setSheet();
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
}
if (num2 == 7)
{
this.OnGround = false;
}
if (num2 == 8)
{
this.OnGround = true;
}
this.newPos.x = this.newPos.x + 1f;
this.sendMove("r");
this.isMovable = false;
if (this.GetIce((int)this.newPos.x, -(int)this.newPos.y))
{
this.IceRight = true;
this.IceUp = false;
this.IceDown = false;
this.IceLeft = false;
}
else
{
this.IceRight = false;
}
int slide4 = this.GetSlide((int)this.newPos.x, -(int)this.newPos.y);
if (slide4 > 0)
{
this.Slide = slide4;
if (this.Slide == 5)
{
this.Slide = 0;
}
}
}
}
else if (num2 == 3)
{
this.PlayerJump.Jump();
this.newPos.x = this.newPos.x + 2f;
this.sendMove("r");
this.isMovable = false;
}
else
{
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
this.IceRight = false;
this.Slide = 0;
this.PlayBump();
}
}
else if (num2 == 14 || num2 == 7 || num2 == 8 || num2 == 9 || num2 == 10 || num2 == 12)
{
if (!this.NPCat((int)this.newPos.x + 1, -(int)this.newPos.y))
{
if (num2 == 8)
{
this.OnGround = true;
}
this.Surf = false;
this.newPos.x = this.newPos.x + 1f;
this.sendMove("r");
this.isMovable = false;
}
}
else
{
this.DirectionToSprite();
this.AniNumber = 0;
this.AniTimer = 0f;
this.IceRight = false;
this.Slide = 0;
this.PlayBump();
}
if (this.pDirection != 4)
{
this.pDirection = 4;
this.DirectionToSprite();
}
this.pDirection = 4;
return;
}
if (!this.GLM.EditPanel.activeSelf && !this.SM.ShopWindow.activeSelf && !this.chatOpen && !this.inTrade && !this.inBattle && !this.MR.LearnWindow.activeSelf && !this.ER.LearnWindow.activeSelf)
{
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot1) || Input.GetKeyUp(this.KeyManager.Hot1S)))
{
this.UseItem(this.ShortcutIDs[0]);
}
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot2) || Input.GetKeyUp(this.KeyManager.Hot2S)))
{
this.UseItem(this.ShortcutIDs[1]);
}
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot3) || Input.GetKeyUp(this.KeyManager.Hot3S)))
{
this.UseItem(this.ShortcutIDs[2]);
}
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot4) || Input.GetKeyUp(this.KeyManager.Hot4S)))
{
this.UseItem(this.ShortcutIDs[3]);
}
}
}
this.Interact(false);
}
if (this.select)
{
if (!this.chatOpen)
{
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot1) || Input.GetKeyUp(this.KeyManager.Hot1S)))
{
this.ClickButton(1);
}
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot2) || Input.GetKeyUp(this.KeyManager.Hot2S)))
{
this.ClickButton(2);
}
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot3) || Input.GetKeyUp(this.KeyManager.Hot3S)))
{
this.ClickButton(3);
}
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot4) || Input.GetKeyUp(this.KeyManager.Hot4S)))
{
this.ClickButton(4);
}
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot5) || Input.GetKeyUp(this.KeyManager.Hot5S)))
{
this.ClickButton(5);
}
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot6) || Input.GetKeyUp(this.KeyManager.Hot6S)))
{
this.ClickButton(6);
}
}
return;
}
if (this.SelectPoke.activeSelf)
{
return;
}
if (this.doMessages != 0 && this.doMessages != 2 && this.doMessages != 5 && (this.Messages.Count > 0 || this.tosay != string.Empty))
{
if ((this.CanPressKey && (Input.GetKeyUp(this.KeyManager.InteractButton) || Input.GetKeyUp(this.KeyManager.InteractButtonS))) || this.TouchedNext)
{
this.UpdateBox = true;
this.TouchedNext = false;
}
if (this.Scrolling && this.tosay != string.Empty)
{
if (this.tosay.Length >= this.ScrollTo + 3 && this.tosay.Substring(this.ScrollTo, 3) == "[-]")
{
this.ScrollTo += 3;
}
if (this.tosay.Length >= this.ScrollTo + 8 && this.tosay.Substring(this.ScrollTo, 1) == "[" && this.tosay.Substring(this.ScrollTo + 7, 1) == "]")
{
this.ScrollTo += 8;
}
this.NPCText.text = this.tosay.Substring(0, this.ScrollTo) + " ";
this.scrollCount += this.SaySpeed * Time.deltaTime;
if (this.scrollCount > 1f)
{
this.ScrollTo++;
this.scrollCount = 0f;
}
if (this.ScrollTo > this.tosay.Length)
{
AudioSource.PlayClipAtPoint(this.TextSound, Camera.main.transform.position, this.SFXVolume);
this.ScrollTo = this.tosay.Length;
this.Scrolling = false;
this.NPCText.text = this.tosay;
this.scrollCount = 0f;
}
else if (this.UpdateBox)
{
this.UpdateBox = false;
this.ScrollTo = this.tosay.Length;
return;
}
}
else if (this.Scripts.Count > 0 && this.Messages.Count == 0 && this.tosay != string.Empty && this.Scripts[0].Status > 2 && this.Scripts[0].Status < 7)
{
this.doMessages = 2;
return;
}
if (this.UpdateBox)
{
if (this.Messages.Count == 0)
{
this.tosay = string.Empty;
this.doMessages = 2;
this.NPCTObject.SetActive(false);
return;
}
if (this.Messages[0] != null)
{
this.NPCTObject.SetActive(true);
this.NPCText.text = string.Empty;
this.UpdateBox = false;
this.Scrolling = true;
this.tosay = this.Messages[0].Message;
this.ScrollTo = 0;
if (this.tosay.Length >= 20 && this.tosay.Substring(0, 4) == "shop")
{
this.SM.Shop_Setup(this.tosay.Substring(4));
this.tosay = string.Empty;
this.UpdateBox = true;
}
if (this.tosay.Length >= 13)
{
if (this.tosay.Substring(0, 13) == "moverelearner")
{
if (this.Pokemons.Count >= Convert.ToInt32(this.tosay.Substring(13)))
{
this.MR.Title.text = "Move Relearner - " + this.Pokemons[Convert.ToInt32(this.tosay.Substring(13)) - 1].pName;
}
else
{
this.MR.Title.text = "Move Relearner";
}
this.MR.PokeID = Convert.ToInt32(this.tosay.Substring(13));
this.sendPacket("a|.|" + this.tosay.Substring(13));
this.tosay = string.Empty;
this.UpdateBox = true;
}
else if (this.tosay.Substring(0, 13) == "eggsrelearner")
{
if (this.Pokemons.Count >= Convert.ToInt32(this.tosay.Substring(13)))
{
this.ER.Title.text = "Egg Move Learner - " + this.Pokemons[Convert.ToInt32(this.tosay.Substring(13)) - 1].pName;
}
else
{
this.ER.Title.text = "Egg Move Learner";
}
this.ER.PokeID = Convert.ToInt32(this.tosay.Substring(13));
this.sendPacket(".|.|" + this.tosay.Substring(13));
this.tosay = string.Empty;
this.UpdateBox = true;
}
}
if (this.tosay.Length >= 10)
{
if (this.tosay.Substring(0, 9) == "playsound")
{
if (this.tosay.Substring(9) == "0")
{
base.StartCoroutine(this.musicPlayer.DimSound3());
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[10], Camera.main.transform.position, this.SFXVolume);
}
else if (this.tosay.Substring(9) == "1")
{
base.StartCoroutine(this.musicPlayer.DimSound3());
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[12], Camera.main.transform.position, this.SFXVolume);
}
else if (this.tosay.Substring(9) == "2")
{
base.StartCoroutine(this.musicPlayer.DimSound3());
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[13], Camera.main.transform.position, this.SFXVolume);
}
else if (this.tosay.Substring(9) == "3")
{
base.StartCoroutine(this.musicPlayer.DimSound6());
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[19], Camera.main.transform.position, this.SFXVolume);
}
else if (this.tosay.Substring(9) == "4")
{
base.StartCoroutine(this.musicPlayer.DimSound6());
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[44], Camera.main.transform.position, this.SFXVolume);
}
this.tosay = string.Empty;
this.UpdateBox = true;
}
else if (this.tosay.Substring(0, 9) == "playmusic")
{
this.scriptMusic = this.mapMusic;
this.resumeMusic = true;
if (this.tosay.Substring(9) == "0")
{
this.PlayMusic(59);
this.scriptMusic = 59;
}
else if (this.tosay.Substring(9) == "1")
{
this.PlayMusic(60);
this.scriptMusic = 60;
}
this.tosay = string.Empty;
this.UpdateBox = true;
}
}
if (this.tosay.Length >= 6)
{
if (this.tosay.Substring(0, 6) == "eglogo")
{
this.GLM.ShowEditor();
this.tosay = string.Empty;
this.UpdateBox = true;
}
else if (this.tosay.Substring(0, 5) == "emote")
{
string[] array = this.tosay.Substring(5).Split(new string[]
{
","
}, StringSplitOptions.None);
int num3 = (int)Convert.ToInt16(array[0]);
for (int i = 0; i < this.NPCS.Count; i++)
{
if (this.NPCS[i] != null)
{
cNPC component2 = this.NPCS[i].GetComponent<cNPC>();
if (component2.ID == num3)
{
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[36], Camera.main.transform.position, this.SFXVolume);
component2.Emote.Show((int)Convert.ToInt16(array[1]), 0);
break;
}
}
}
this.tosay = string.Empty;
this.UpdateBox = true;
}
}
if (this.tosay.Length >= 8 && this.tosay.Substring(0, 7) == "playcry")
{
this.PlayCry(Convert.ToInt32(this.tosay.Substring(7)), 0f);
this.tosay = string.Empty;
this.UpdateBox = true;
}
List<DSSock.NPCMessage> messages = this.Messages;
lock (messages)
{
this.Messages.RemoveAt(0);
}
if (this.Messages.Count == 0 && this.tosay == string.Empty)
{
this.NPCTObject.SetActive(false);
this.doMessages = 2;
return;
}
}
}
}
else if (this.Scripts.Count > 0)
{
this.ScriptPause = true;
if (this.bagGUI.activeSelf)
{
this.bagGUI.SetActive(false);
}
if (this.Scripts[0].Status == 0 && this.Scripts[0].Message == string.Empty && this.doMessages == 3)
{
List<DSSock.ScriptClass> scripts = this.Scripts;
lock (scripts)
{
this.Scripts.RemoveAt(0);
this.doMessages = 0;
}
if (this.stopNPC)
{
this.stopNPC.Stopped = false;
this.stopNPC = null;
}
if (this.resumeMusic && this.scriptMusic != this.mapMusic)
{
this.PlayMusic(this.mapMusic);
this.resumeMusic = false;
}
}
else
{
if (this.doMessages == 0)
{
for (int j = 0; j < 6; j++)
{
this.ChoiceButtons[j].SetActive(false);
}
this.doMessages = 1;
this.Messages = new List<DSSock.NPCMessage>();
List<DSSock.NPCMessage> messages2 = this.Messages;
lock (messages2)
{
string[] array2 = this.Scripts[0].Message.Split(new string[]
{
"-=-"
}, StringSplitOptions.None);
for (int k = 0; k < array2.Length; k++)
{
DSSock.NPCMessage nPCMessage = new DSSock.NPCMessage();
nPCMessage.Message = array2[k];
this.Messages.Add(nPCMessage);
}
}
this.UpdateBox = true;
this.Scripts[0].Message = string.Empty;
}
if (this.doMessages == 2)
{
if (this.Scripts[0].Status == 1)
{
this.sendPacket("R|.|" + this.Scripts[0].ID + "|.|0");
}
if (this.Scripts[0].Status == 3)
{
this.select = true;
this.NPCTObject.SetActive(true);
for (int l = 0; l < this.Scripts[0].Options.Count; l++)
{
this.ChoiceButtons[l].SetActive(true);
this.ChoiceText[l].text = (l + 1).ToString() + ". " + this.Scripts[0].Options[l].Message;
}
this.doMessages = 4;
return;
}
if (this.Scripts[0].Status == 4)
{
this.SelectPoke.SetActive(true);
this.SelectPoke.GetComponent<ShowPokemons>().Setup();
this.doMessages = 5;
return;
}
this.doMessages = 3;
}
}
}
else
{
this.ScriptPause = false;
}
}
}
public bool checkCut()
{
bool flag = false;
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].ID == 838)
{
flag = true;
break;
}
}
if (flag)
{
for (int j = 0; j < this.Items.Count; j++)
{
if (this.Items[j].ID == 317)
{
return true;
}
}
}
for (int k = 0; k < this.Pokemons.Count; k++)
{
for (int l = 0; l < 4; l++)
{
if (this.Pokemons[k].Attack[l] != null && this.Pokemons[k].Attack[l] == "Cut")
{
return true;
}
}
}
return false;
}
public bool checkSmash()
{
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].ID == 839)
{
return true;
}
}
for (int j = 0; j < this.Pokemons.Count; j++)
{
for (int k = 0; k < 4; k++)
{
if (this.Pokemons[j].Attack[k] != null && this.Pokemons[j].Attack[k] == "Rock Smash")
{
return true;
}
}
}
return false;
}
public bool checkSurf()
{
if (this.Surf)
{
return false;
}
for (int i = 0; i < this.Pokemons.Count; i++)
{
for (int j = 0; j < 4; j++)
{
if (this.Pokemons[i].Attack[j] != null && this.Pokemons[i].Attack[j] == "Surf")
{
return true;
}
}
}
return false;
}
public bool checkFlash()
{
for (int i = 0; i < this.Pokemons.Count; i++)
{
for (int j = 0; j < 4; j++)
{
if (this.Pokemons[i].Attack[j] != null && this.Pokemons[i].Attack[j] == "Flash")
{
return true;
}
}
}
return false;
}
public void Interact(bool touchButton)
{
if (!this.LoggedIn)
{
return;
}
if (this.chatOpen)
{
return;
}
if (this.MessageStuck)
{
return;
}
if (this.ScriptPause)
{
return;
}
if (this.inBattle)
{
return;
}
if (this.inTrade)
{
return;
}
if (this.SM.ShopWindow.activeSelf)
{
return;
}
if (this.NPCTObject.activeSelf)
{
return;
}
if (!this.CanMove)
{
return;
}
if (this.MoveGUIs.activeSelf)
{
return;
}
if (this.MR.LearnWindow.activeSelf)
{
return;
}
if (this.ER.LearnWindow.activeSelf)
{
return;
}
if (this.GLM.EditPanel.activeSelf)
{
return;
}
if ((this.CanPressKey && (Input.GetKeyUp(this.KeyManager.InteractButton) || Input.GetKeyUp(this.KeyManager.InteractButtonS))) || touchButton)
{
if (Time.time <= this.lastInteracted + 0.65f && this.lastInteracted != 0f)
{
return;
}
this.lastInteracted = Time.time;
if (!this.mapCreator.loading && (int)(-(int)this.Player.position.y) > 1)
{
int num = this.mapCreator.Tiles2[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1];
if (num == 5437)
{
if (!this.PCBox.activeSelf)
{
this.openPC();
}
return;
}
num = this.mapCreator.Tiles3[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1];
if (num == 5437)
{
if (!this.PCBox.activeSelf)
{
this.openPC();
}
return;
}
}
switch (this.pDirection)
{
case 1:
{
int num = this.mapCreator.Colliders[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1];
if (num == 11)
{
if (this.checkCut())
{
this.mapCreator.Colliders[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1] = 0;
this.mapCreator.Tiles2[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1] = 0;
this.mapCreator.Tiles4[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1] = 0;
this.AddChat("[40FF00]" + this.Lang.GetString("CutMessage") + "[-]", "System");
AudioSource.PlayClipAtPoint(this.treeSound, Camera.main.transform.position, this.SFXVolume);
this.mapCreator.destroyTree((int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1);
return;
}
GameObject x = GameObject.Find(this.Lang.GetString("UseCut"));
if (x == null)
{
this.MSGBOX(this.Lang.GetString("UseCut"), this.Lang.GetString("UseCutDesc"), false);
}
}
else if (num == 13)
{
if (this.checkSmash())
{
this.mapCreator.Colliders[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1] = 0;
this.mapCreator.Tiles2[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1] = 0;
this.mapCreator.Tiles3[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1] = 0;
this.AddChat("[40FF00]" + this.Lang.GetString("SmashMessage") + "[-]", "System");
AudioSource.PlayClipAtPoint(this.SmashSound, Camera.main.transform.position, this.SFXVolume);
this.mapCreator.destroyRock((int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1);
return;
}
GameObject x2 = GameObject.Find(this.Lang.GetString("UseSmash"));
if (x2 == null)
{
this.MSGBOX(this.Lang.GetString("UseSmash"), this.Lang.GetString("UseSmashDesc"), false);
}
}
else if ((num == 5 || num == 12) && this.OnGround && this.mapCreator.Colliders[(int)this.Player.position.x, (int)(-(int)this.Player.position.y)] != 14 && this.checkSurf())
{
GameObject x3 = GameObject.Find(this.Lang.GetString("UseSurf"));
if (x3 == null)
{
this.MSGBOX(this.Lang.GetString("UseSurf"), this.Lang.GetString("UseSurfDesc"), true);
}
return;
}
break;
}
case 2:
{
int num = this.mapCreator.Colliders[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1];
if (num == 11)
{
if (this.checkCut())
{
this.mapCreator.Colliders[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1] = 0;
this.mapCreator.Tiles2[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1] = 0;
this.mapCreator.Tiles4[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1] = 0;
this.AddChat("[40FF00]" + this.Lang.GetString("CutMessage") + "[-]", "System");
AudioSource.PlayClipAtPoint(this.treeSound, Camera.main.transform.position, this.SFXVolume);
this.mapCreator.destroyTree((int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1);
return;
}
GameObject x4 = GameObject.Find(this.Lang.GetString("UseCut"));
if (x4 == null)
{
this.MSGBOX(this.Lang.GetString("UseCut"), this.Lang.GetString("UseCutDesc"), false);
}
}
else if (num == 13)
{
if (this.checkSmash())
{
this.mapCreator.Colliders[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1] = 0;
this.mapCreator.Tiles2[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1] = 0;
this.mapCreator.Tiles3[(int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1] = 0;
this.AddChat("[40FF00]" + this.Lang.GetString("SmashMessage") + "[-]", "System");
AudioSource.PlayClipAtPoint(this.SmashSound, Camera.main.transform.position, this.SFXVolume);
this.mapCreator.destroyRock((int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1);
return;
}
GameObject x5 = GameObject.Find(this.Lang.GetString("UseSmash"));
if (x5 == null)
{
this.MSGBOX(this.Lang.GetString("UseSmash"), this.Lang.GetString("UseSmashDesc"), false);
}
}
else if ((num == 5 || num == 12) && this.OnGround && this.checkSurf())
{
GameObject x6 = GameObject.Find(this.Lang.GetString("UseSurf"));
if (x6 == null)
{
this.MSGBOX(this.Lang.GetString("UseSurf"), this.Lang.GetString("UseSurfDesc"), true);
}
return;
}
break;
}
case 3:
if ((int)this.newPos.x > 0)
{
int num = this.mapCreator.Colliders[(int)this.newPos.x - 1, -(int)this.newPos.y];
if (num == 11)
{
if (this.checkCut())
{
this.mapCreator.Colliders[(int)this.newPos.x - 1, -(int)this.newPos.y] = 0;
this.mapCreator.Tiles2[(int)this.newPos.x - 1, -(int)this.newPos.y] = 0;
this.mapCreator.Tiles4[(int)this.newPos.x - 1, -(int)this.newPos.y] = 0;
this.AddChat("[40FF00]" + this.Lang.GetString("CutMessage") + "[-]", "System");
AudioSource.PlayClipAtPoint(this.treeSound, Camera.main.transform.position, this.SFXVolume);
this.mapCreator.destroyTree((int)this.newPos.x - 1, -(int)this.newPos.y);
return;
}
GameObject x7 = GameObject.Find(this.Lang.GetString("UseCut"));
if (x7 == null)
{
this.MSGBOX(this.Lang.GetString("UseCut"), this.Lang.GetString("UseCutDesc"), false);
}
}
else if (num == 13)
{
if (this.checkSmash())
{
this.mapCreator.Colliders[(int)this.newPos.x - 1, -(int)this.newPos.y] = 0;
this.mapCreator.Tiles2[(int)this.newPos.x - 1, -(int)this.newPos.y] = 0;
this.mapCreator.Tiles3[(int)this.newPos.x - 1, -(int)this.newPos.y] = 0;
this.AddChat("[40FF00]" + this.Lang.GetString("SmashMessage") + "[-]", "System");
AudioSource.PlayClipAtPoint(this.SmashSound, Camera.main.transform.position, this.SFXVolume);
this.mapCreator.destroyRock((int)this.newPos.x - 1, -(int)this.newPos.y);
return;
}
GameObject x8 = GameObject.Find(this.Lang.GetString("UseSmash"));
if (x8 == null)
{
this.MSGBOX(this.Lang.GetString("UseSmash"), this.Lang.GetString("UseSmashDesc"), false);
}
}
else if ((num == 5 || num == 12) && this.OnGround && this.checkSurf())
{
GameObject x9 = GameObject.Find(this.Lang.GetString("UseSurf"));
if (x9 == null)
{
this.MSGBOX(this.Lang.GetString("UseSurf"), this.Lang.GetString("UseSurfDesc"), true);
}
return;
}
}
break;
case 4:
if ((int)this.newPos.x < this.mapCreator.Width)
{
int num = this.mapCreator.Colliders[(int)this.newPos.x + 1, -(int)this.newPos.y];
if (num == 11)
{
if (this.checkCut())
{
this.mapCreator.Colliders[(int)this.newPos.x + 1, -(int)this.newPos.y] = 0;
this.mapCreator.Tiles2[(int)this.newPos.x + 1, -(int)this.newPos.y] = 0;
this.mapCreator.Tiles4[(int)this.newPos.x + 1, -(int)this.newPos.y] = 0;
this.AddChat("[40FF00]" + this.Lang.GetString("CutMessage") + "[-]", "System");
AudioSource.PlayClipAtPoint(this.treeSound, Camera.main.transform.position, this.SFXVolume);
this.mapCreator.destroyTree((int)this.newPos.x + 1, -(int)this.newPos.y);
return;
}
GameObject x10 = GameObject.Find(this.Lang.GetString("UseCut"));
if (x10 == null)
{
this.MSGBOX(this.Lang.GetString("UseCut"), this.Lang.GetString("UseCutDesc"), false);
}
}
else if (num == 13)
{
if (this.checkSmash())
{
this.mapCreator.Colliders[(int)this.newPos.x + 1, -(int)this.newPos.y] = 0;
this.mapCreator.Tiles2[(int)this.newPos.x + 1, -(int)this.newPos.y] = 0;
this.mapCreator.Tiles3[(int)this.newPos.x + 1, -(int)this.newPos.y] = 0;
this.AddChat("[40FF00]" + this.Lang.GetString("SmashMessage") + "[-]", "System");
AudioSource.PlayClipAtPoint(this.SmashSound, Camera.main.transform.position, this.SFXVolume);
this.mapCreator.destroyRock((int)this.newPos.x + 1, -(int)this.newPos.y);
return;
}
GameObject x11 = GameObject.Find(this.Lang.GetString("UseSmash"));
if (x11 == null)
{
this.MSGBOX(this.Lang.GetString("UseSmash"), this.Lang.GetString("UseSmashDesc"), false);
}
}
else if ((num == 5 || num == 12) && this.OnGround && this.checkSurf())
{
GameObject x12 = GameObject.Find(this.Lang.GetString("UseSurf"));
if (x12 == null)
{
this.MSGBOX(this.Lang.GetString("UseSurf"), this.Lang.GetString("UseSurfDesc"), true);
}
return;
}
}
break;
}
int num2 = 0;
if (this.pDirection == 1)
{
num2 = this.IDNPCat((int)this.Player.position.x, (int)(-(int)this.Player.position.y) - 1);
}
if (this.pDirection == 2)
{
num2 = this.IDNPCat((int)this.Player.position.x, (int)(-(int)this.Player.position.y) + 1);
}
if (this.pDirection == 3)
{
num2 = this.IDNPCat((int)this.Player.position.x - 1, (int)(-(int)this.Player.position.y));
}
if (this.pDirection == 4)
{
num2 = this.IDNPCat((int)this.Player.position.x + 1, (int)(-(int)this.Player.position.y));
}
if (num2 > 0)
{
cNPC component = this.NPCS[num2 - 1].GetComponent<cNPC>();
if (component.LOSLength >= 100)
{
return;
}
if (component.Message == string.Empty)
{
this.stopNPC = component;
component.Stopped = true;
component.LOSExpired = true;
this.ShowLevel = component.ShowLevel;
this.sendPacket("N|.|" + component.ID.ToString());
this.MessageStuck = true;
}
if (component.Style != "10" && component.Style != "11" && component.Style != "42" && component.Style != "43" && component.Style != "44" && component.Style != "45" && component.Style != "49" && component.Style != "50" && component.Style != "51" && component.Style != "52" && component.Style != "55" && component.Style != "56" && component.Style != "57" && component.Style != "58" && component.Style != "59" && component.Style != "60" && component.Style != "61" && component.Style != "62" && component.Style != "63" && component.Style != "68")
{
if (this.pDirection == 1)
{
component.Direction = 2;
component.DirectionToSprite();
}
if (this.pDirection == 2)
{
component.Direction = 0;
component.DirectionToSprite();
}
if (this.pDirection == 3)
{
component.Direction = 1;
component.DirectionToSprite();
}
if (this.pDirection == 4)
{
component.Direction = 3;
component.DirectionToSprite();
}
}
return;
}
}
}
public void TouchScript()
{
if (this.MessageStuck || this.ScriptPause)
{
if (this.doMessages != 0 && this.doMessages != 2 && (this.Messages.Count > 0 || this.tosay != string.Empty))
{
this.TouchedNext = true;
}
}
}
public void ClickButton(int ID)
{
if (!this.select)
{
return;
}
if (this.Scripts[0].Options.Count > ID - 1)
{
this.select = false;
this.doMessages = 4;
this.tosay = string.Empty;
this.sendPacket(string.Concat(new object[]
{
"R|.|",
this.Scripts[0].ID,
"|.|",
ID
}));
for (int i = 0; i < 6; i++)
{
this.ChoiceButtons[i].SetActive(false);
}
return;
}
}
private void HandleQue()
{
if (this.inBattle)
{
return;
}
if (this.QuedScripts.Count == 0)
{
return;
}
this.HandleScript(this.QuedScripts[0].ID, this.QuedScripts[0].Status, this.QuedScripts[0].Message, true);
this.QuedScripts.RemoveAt(0);
}
private void HandleScript(string ID, int Status, string Message, bool DOTHIS = false)
{
this.UnlockPlayer();
this.MessageStuck = false;
if (!DOTHIS)
{
if (this.inBattle)
{
DSSock.ScriptClass scriptClass = new DSSock.ScriptClass();
scriptClass.Status = Status;
scriptClass.Message = Message;
scriptClass.ID = ID;
List<DSSock.ScriptClass> quedScripts = this.QuedScripts;
lock (quedScripts)
{
this.QuedScripts.Add(scriptClass);
}
return;
}
if (this.QuedScripts.Count > 0)
{
DSSock.ScriptClass scriptClass2 = new DSSock.ScriptClass();
scriptClass2.Status = Status;
scriptClass2.Message = Message;
scriptClass2.ID = ID;
List<DSSock.ScriptClass> quedScripts2 = this.QuedScripts;
lock (quedScripts2)
{
this.QuedScripts.Add(scriptClass2);
}
return;
}
}
if (this.Scripts.Count > 0)
{
for (int i = 0; i < this.Scripts.Count; i++)
{
if (this.Scripts[i].ID == ID)
{
this.Scripts[i].Status = Status;
this.Scripts[i].Message = Message;
this.UpdateScript(i);
this.doMessages = 0;
return;
}
}
}
DSSock.ScriptClass scriptClass3 = new DSSock.ScriptClass();
scriptClass3.ID = ID;
scriptClass3.Message = Message;
scriptClass3.Status = Status;
this.doMessages = 0;
List<DSSock.ScriptClass> scripts = this.Scripts;
lock (scripts)
{
this.Scripts.Add(scriptClass3);
}
this.UpdateScript(this.Scripts.Count - 1);
}
private void UpdateScript(int ID)
{
if (this.Scripts[ID].Message.IndexOf("-#-") > -1 && this.Scripts[ID].Status > 1)
{
string[] array = this.Scripts[ID].Message.Split(new string[]
{
"-#-"
}, StringSplitOptions.None);
this.Scripts[ID].Options = new List<DSSock.NPCMessage>();
for (int i = 1; i < array.Length; i++)
{
if (array[i].Length > 0)
{
DSSock.NPCMessage nPCMessage = new DSSock.NPCMessage();
nPCMessage.Message = array[i];
List<DSSock.NPCMessage> options = this.Scripts[ID].Options;
lock (options)
{
this.Scripts[ID].Options.Add(nPCMessage);
}
}
}
this.Scripts[ID].Message = array[0];
}
}
public void AttemptLogin(string usern, string pass)
{
SHDE.PROSD();
Regex regex = new Regex("[^a-zA-Z0-9]");
usern = regex.Replace(usern, string.Empty);
this.user.value = usern;
this.user.UpdateLabel();
this.LoggedIn = false;
this.sendPacket(string.Concat(new string[]
{
"+|.|",
usern,
"|.|",
pass,
"|.|",
this.Vers,
"|.|",
base.GetComponent<PAdd>().SNI()
}));
}
public void UseFlash()
{
if (this.checkFlash() && (this.mapCreator.mapName.ToLower().IndexOf("rock tunnel") != -1 || this.mapCreator.mapName.ToLower().IndexOf("valley cave") != -1 || this.mapCreator.MapWeather == "FlashDark"))
{
if (!this.FlashOn)
{
this.Darkness.transform.localScale = new Vector3(30f, 25f, 1f);
this.FlashOn = true;
}
else
{
this.Darkness.transform.localScale = new Vector3(5f, 5f, 1f);
this.FlashOn = false;
}
}
}
private void loadMap(string map)
{
string mapWeather = this.mapCreator.MapWeather;
this.PCBox.SetActive(false);
if (map == null)
{
return;
}
this.keyLock = true;
string text = string.Empty;
text = map.ToLower();
this.Darkness.SetActive(false);
if (text.IndexOf("pokecenter") != -1)
{
int num = UnityEngine.Random.Range(1, 3);
if (num <= 1)
{
this.PlayMusic(4);
this.mapMusic = 4;
}
else if (num >= 2)
{
this.PlayMusic(65);
this.mapMusic = 65;
}
}
else if (text.IndexOf("mart") != -1)
{
this.PlayMusic(64);
this.mapMusic = 64;
}
else if (text.IndexOf("cryofrost") != -1 || text.IndexOf("frost va") != -1 || text.IndexOf("mistpeak") != -1 || text.IndexOf("snowfall v") != -1 || text.IndexOf("flake wood") != -1)
{
int num2 = UnityEngine.Random.Range(0, 3);
if (num2 == 0)
{
this.PlayMusic(77);
this.mapMusic = 77;
}
else if (num2 == 1)
{
this.PlayMusic(78);
this.mapMusic = 78;
}
else if (num2 == 2)
{
this.PlayMusic(77);
this.mapMusic = 77;
}
else if (num2 == 3)
{
this.PlayMusic(78);
this.mapMusic = 78;
}
}
else if (text.IndexOf("gym") != -1)
{
this.PlayMusic(2);
this.mapMusic = 2;
}
else if (text.IndexOf("goldenrod city") != -1)
{
this.PlayMusic(3);
this.mapMusic = 3;
}
else if (text.IndexOf("pallet town") != -1)
{
this.PlayMusic(5);
this.mapMusic = 5;
}
else if (text == "route 1")
{
this.PlayMusic(3);
this.mapMusic = 3;
}
else if (text.IndexOf("mt. moon") != -1)
{
this.PlayMusic(14);
this.mapMusic = 14;
}
else if (text.IndexOf("oaks lab") != -1)
{
this.PlayMusic(16);
this.mapMusic = 16;
}
else if (text.IndexOf("route 3") != -1)
{
this.PlayMusic(15);
this.mapMusic = 15;
}
else if (text.IndexOf("viridian forest") != -1)
{
this.PlayMusic(17);
this.mapMusic = 17;
}
else if (text.IndexOf("lavender") != -1)
{
this.PlayMusic(18);
this.mapMusic = 18;
}
else if (text.IndexOf("celadon") != -1)
{
this.PlayMusic(30);
this.mapMusic = 30;
}
else if (text.IndexOf("cerulean cave") != -1 || text.IndexOf("silph co") != -1)
{
this.PlayMusic(29);
this.mapMusic = 29;
}
else if (text.IndexOf("cerulean city") != -1)
{
this.PlayMusic(31);
this.mapMusic = 31;
}
else if (text.IndexOf("tower underground") != -1)
{
this.PlayMusic(37);
this.mapMusic = 37;
}
else if (text.IndexOf("pokemon tower") != -1)
{
this.PlayMusic(33);
this.mapMusic = 33;
}
else if (text.IndexOf("love island") != -1)
{
this.PlayMusic(35);
this.mapMusic = 35;
}
else if (text.IndexOf("safari exclusive") != -1)
{
this.PlayMusic(35);
this.mapMusic = 35;
}
else if (text.IndexOf("saffron city") != -1)
{
this.PlayMusic(39);
this.mapMusic = 39;
}
else if (text.IndexOf("dragons den") != -1)
{
this.PlayMusic(40);
this.mapMusic = 40;
}
else if (text.IndexOf("pewter city") != -1)
{
this.PlayMusic(45);
this.mapMusic = 45;
}
else if (text.IndexOf("rocket hideout") != -1)
{
this.PlayMusic(51);
this.mapMusic = 51;
}
else if (text.IndexOf("ssanne") != -1)
{
this.PlayMusic(46);
this.mapMusic = 46;
}
else if (text.IndexOf("start") != -1)
{
this.PlayMusic(61);
this.mapMusic = 61;
}
else if (text.IndexOf("indigo plateau") != -1)
{
this.PlayMusic(62);
this.mapMusic = 62;
}
else if (text.IndexOf("elite four") != -1)
{
this.PlayMusic(63);
this.mapMusic = 63;
}
else if (text.IndexOf("festival town") != -1 || text.IndexOf("cemetery island") != -1)
{
this.PlayMusic(75);
this.mapMusic = 75;
}
else if (text.IndexOf("bone pass") != -1 || text.IndexOf("haunted house") != -1)
{
this.PlayMusic(76);
this.mapMusic = 76;
}
else if (text.IndexOf("school") != -1)
{
this.PlayMusic(69);
this.mapMusic = 69;
}
else
{
int num3 = UnityEngine.Random.Range(0, 5);
if (num3 == 0)
{
this.PlayMusic(1);
this.mapMusic = 1;
}
else if (num3 == 1)
{
this.PlayMusic(25);
this.mapMusic = 25;
}
else if (num3 == 2)
{
this.PlayMusic(26);
this.mapMusic = 26;
}
else if (num3 == 3)
{
this.PlayMusic(27);
this.mapMusic = 27;
}
else if (num3 >= 4)
{
this.PlayMusic(38);
this.mapMusic = 38;
}
}
if (this.StartScreen.activeSelf)
{
this.PlayMusic(11);
}
this.loadingMap = true;
this.mapCreator.mapName = map;
this.con.Add("PRO> Loading Map <" + map + ">.");
this.DestroyNPC();
this.mapCreator.loadMap();
if (this.mapCreator.MapWeather == "Rain")
{
this.Rain.SetActive(true);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Snow")
{
this.Rain.SetActive(false);
this.Snow.SetActive(true);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Drought")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(true);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Sandstorm")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(true);
}
else if (this.mapCreator.MapWeather == "FlashDark")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Leaves")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Tower Fog")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "None" && mapWeather != "None")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
this.loadingMap = false;
if (text.IndexOf("rock tunnel") != -1 || text.IndexOf("valley cave") != -1 || this.mapCreator.MapWeather == "FlashDark")
{
if (!this.FlashOn)
{
this.Darkness.SetActive(true);
this.Darkness.transform.localScale = new Vector3(5f, 5f, 1f);
this.FlashOn = false;
}
else
{
this.Darkness.SetActive(true);
this.Darkness.transform.localScale = new Vector3(30f, 25f, 1f);
}
}
else
{
this.FlashOn = false;
}
this.ScreenFade.FadeIn();
this.sendPacket("-");
this.sendPacket("k|.|" + text);
this.FollowPoke.transform.position = this.Player.position + new Vector3(0f, 1f, 0f);
this.FollowPoke.LastPostion = this.Player.position + new Vector3(0f, 1f, 0f);
}
private void SyncUser(string mapName, int x, int y)
{
if (mapName.Length > 1)
{
this.bSync = false;
Vector3 position;
position.x = (float)x;
position.y = (float)(-(float)y);
position.z = 0f;
this.Players.X = x;
this.Players.Y = y;
this.Player.position = position;
this.newPos = this.Player.position;
if (this.currentMap != mapName)
{
this.currentMap = mapName;
this.loadMap(this.currentMap);
}
if (this.FollowPoke.transform.position.x <= this.Player.position.x - 2f || this.FollowPoke.transform.position.x >= this.Player.position.x + 2f || this.FollowPoke.transform.position.y <= this.Player.position.y - 2f || this.FollowPoke.transform.position.y >= this.Player.position.y + 2f)
{
this.FollowPoke.transform.position = this.Player.position + new Vector3(0f, 1f, 0f);
this.FollowPoke.LastPostion = this.Player.position + new Vector3(0f, 1f, 0f);
}
}
}
private void MoveUser(string mapName, int x, int y, int tosurf)
{
if (mapName == null)
{
return;
}
Vector3 position;
position.x = (float)x;
position.y = (float)(-(float)y);
position.z = 0f;
this.Players.X = x;
this.Players.Y = y;
this.bSync = true;
this.Player.position = position;
this.newPos = this.Player.position;
if (this.currentMap != mapName)
{
this.Slide = 0;
this.IceUp = false;
this.IceDown = false;
this.IceRight = false;
this.IceLeft = false;
this.currentMap = mapName;
this.loadMap(this.currentMap);
}
this.sendSync();
if (this.FollowPoke.transform.position.x <= this.Player.position.x - 2f || this.FollowPoke.transform.position.x >= this.Player.position.x + 2f || this.FollowPoke.transform.position.y <= this.Player.position.y - 2f || this.FollowPoke.transform.position.y >= this.Player.position.y + 2f)
{
this.FollowPoke.transform.position = this.Player.position + new Vector3(0f, 1f, 0f);
this.FollowPoke.LastPostion = this.Player.position + new Vector3(0f, 1f, 0f);
}
if (this.FollowPoke.transform.position == this.Player.position)
{
this.FollowPoke.transform.position = this.Player.position + new Vector3(0f, 1f, 0f);
this.FollowPoke.LastPostion = this.Player.position + new Vector3(0f, 1f, 0f);
}
if (tosurf == 1)
{
this.Surf = true;
this.Bike = false;
this.setSheet();
this.DirectionToSprite();
}
}
private void sendSync()
{
this.sendPacket("S");
}
private void updatePlayer(string sName, int Xpos, int Ypos, string action, string style, byte AFK, byte Battle, int F, byte S, byte M, byte Item, string OnGround, string guildID, int form)
{
if (this.loadingMap)
{
return;
}
if (sName == string.Empty)
{
return;
}
Vector3 vector;
vector.x = (float)Xpos;
vector.y = (float)(-(float)Ypos) + 0.6f;
float num = (float)Ypos;
vector.z = -(num / 30000f);
if (OnGround == "0")
{
vector.z += -6f;
}
if (this.Player.position.x < vector.x - 15f || this.Player.position.x > vector.x + 15f || this.Player.position.y < vector.y - 14f || this.Player.position.y > vector.y + 14f)
{
action = "o";
}
GameObject gameObject = null;
PlayerVaribles playerVaribles = null;
int depth = this.PlayerObjects.Count;
List<GameObject> playerObjects = this.PlayerObjects;
lock (playerObjects)
{
if (this.PlayerObjects.Count > 0)
{
for (int i = 0; i < this.PlayerObjects.Count; i++)
{
if (this.PlayerObjects[i].name == "User: " + sName)
{
gameObject = this.PlayerObjects[i];
depth = i;
break;
}
}
}
}
bool flag = false;
bool flag2 = false;
FPoke fPoke;
if (gameObject == null)
{
if (action == "o")
{
return;
}
Vector3 position = new Vector3(-1000f, 1000f, 0f);
gameObject = (UnityEngine.Object.Instantiate(this.PlayerObject, position, Quaternion.identity) as GameObject);
playerVaribles = gameObject.GetComponent<PlayerVaribles>();
playerVaribles.pname = sName;
playerVaribles.Map = this.currentMap;
playerVaribles.setName();
playerVaribles.lastY = (float)(-(float)Ypos);
playerVaribles.Style = style;
vector.y = (float)(-(float)Ypos) + 0.6f;
gameObject.name = "User: " + sName;
gameObject.transform.position = vector;
fPoke = (UnityEngine.Object.Instantiate(this.PFollowObject, vector, Quaternion.identity) as FPoke);
fPoke.transform.position = vector + new Vector3(0f, 1f, 0f);
playerVaribles.Follower = fPoke;
playerVaribles.Follower.sortZ();
playerVaribles.isMember = M;
playerVaribles.AFK = AFK;
playerVaribles.Battle = Battle;
playerVaribles.Item = Item;
playerVaribles.guildID = guildID;
playerVaribles.GetLogo();
flag = true;
List<GameObject> playerObjects2 = this.PlayerObjects;
lock (playerObjects2)
{
this.PlayerObjects.Add(gameObject);
}
}
else
{
playerVaribles = gameObject.GetComponent<PlayerVaribles>();
fPoke = playerVaribles.Follower;
flag2 = playerVaribles.UnRemove();
playerVaribles.pname = sName;
playerVaribles.Map = this.currentMap;
playerVaribles.setName();
playerVaribles.lastY = (float)(-(float)Ypos);
playerVaribles.Style = style;
playerVaribles.isMember = M;
playerVaribles.AFK = AFK;
playerVaribles.Battle = Battle;
playerVaribles.Item = Item;
playerVaribles.guildID = guildID;
playerVaribles.GetLogo();
}
playerVaribles.SetDepth(depth);
playerVaribles.lastheardfrom = Time.time;
if (action == "n")
{
playerVaribles.Direction = 0;
}
if (action == "s")
{
playerVaribles.Direction = 2;
}
if (action == "e")
{
playerVaribles.Direction = 1;
}
if (action == "w")
{
playerVaribles.Direction = 3;
}
fPoke.PokeID(Convert.ToInt32(F), S, form);
playerVaribles.ChangeSpriteSheet();
if (OnGround == "1")
{
fPoke.OnTop(false);
}
else
{
fPoke.OnTop(true);
}
if (flag2)
{
flag = true;
}
if (flag)
{
playerVaribles.DirectionToSprite();
}
if (!flag && playerVaribles.QUE.Count < 50 && playerVaribles.moving)
{
if (OnGround == "1")
{
playerVaribles.addQue(action, vector, false);
}
else
{
playerVaribles.addQue(action, vector, true);
}
fPoke.LastPostion = gameObject.transform.position;
playerVaribles.moving = true;
return;
}
vector.z = -((num - 1f) / 30000f);
if (flag || Vector3.Distance(gameObject.transform.position, vector) >= 3f)
{
gameObject.transform.position = vector;
}
if (fPoke.transform.position.x > gameObject.transform.position.x + 3f || fPoke.transform.position.x < gameObject.transform.position.x - 3f || fPoke.transform.position.y > gameObject.transform.position.y + 3f || fPoke.transform.position.y < gameObject.transform.position.y - 3f)
{
fPoke.transform.position = gameObject.transform.position + new Vector3(0f, 1f, 0f);
fPoke.LastPostion = gameObject.transform.position + new Vector3(0f, 1f, 0f);
}
playerVaribles.clearQue();
if (OnGround == "1")
{
playerVaribles.OnGround = true;
}
else
{
fPoke.OnTop(true);
playerVaribles.OnGround = false;
}
if (action == "o")
{
playerVaribles.Remove();
return;
}
if (action == "u")
{
vector.z = -((num - 1f) / 30000f);
fPoke.LastPostion = playerVaribles.transform.position;
playerVaribles.moveTO = vector;
PlayerVaribles expr_6C3_cp_0 = playerVaribles;
expr_6C3_cp_0.moveTO.y = expr_6C3_cp_0.moveTO.y + 1f;
if (Item == 2 && !playerVaribles.AF.Mount)
{
this.createBikeStep((int)playerVaribles.transform.position.x, -(int)playerVaribles.transform.position.y + 1, playerVaribles.transform.position.z, 0, action, playerVaribles.lastDir);
}
playerVaribles.lastDir = 1;
}
else if (action == "d")
{
vector.z = -((num + 1f) / 30000f);
fPoke.LastPostion = playerVaribles.transform.position;
playerVaribles.moveTO = vector;
PlayerVaribles expr_795_cp_0 = playerVaribles;
expr_795_cp_0.moveTO.y = expr_795_cp_0.moveTO.y - 1f;
if (Item == 2 && !playerVaribles.AF.Mount)
{
this.createBikeStep((int)playerVaribles.transform.position.x, -(int)playerVaribles.transform.position.y + 1, playerVaribles.transform.position.z, 0, action, playerVaribles.lastDir);
}
playerVaribles.lastDir = 2;
}
else if (action == "l")
{
playerVaribles.moveTO = vector;
fPoke.LastPostion = playerVaribles.transform.position;
PlayerVaribles expr_852_cp_0 = playerVaribles;
expr_852_cp_0.moveTO.x = expr_852_cp_0.moveTO.x - 1f;
if (Item == 2 && !playerVaribles.AF.Mount)
{
this.createBikeStep((int)playerVaribles.transform.position.x, -(int)playerVaribles.transform.position.y + 1, playerVaribles.transform.position.z, 0, action, playerVaribles.lastDir);
}
playerVaribles.lastDir = 3;
}
else if (action == "r")
{
playerVaribles.moveTO = vector;
fPoke.LastPostion = playerVaribles.transform.position;
PlayerVaribles expr_90F_cp_0 = playerVaribles;
expr_90F_cp_0.moveTO.x = expr_90F_cp_0.moveTO.x + 1f;
if (Item == 2 && !playerVaribles.AF.Mount)
{
this.createBikeStep((int)playerVaribles.transform.position.x, -(int)playerVaribles.transform.position.y + 1, playerVaribles.transform.position.z, 0, action, playerVaribles.lastDir);
}
playerVaribles.lastDir = 4;
}
playerVaribles.moving = true;
}
private void AddMessage(string message)
{
this.messageTimer = 10f;
this.messageText = message.Substring(1);
this.MText.gameObject.SetActive(true);
}
private void LoadItems(string strSplit)
{
this.Items = new List<DSSock.cItem>();
string[] array = strSplit.Split(new string[]
{
"\r\n"
}, StringSplitOptions.None);
for (int i = 0; i < 24; i++)
{
this.Badge[i].color = new Color(0f, 0f, 0f, 0.7f);
}
for (int j = 0; j < array.Length - 1; j++)
{
string[] array2 = array[j].Split(new string[]
{
"|"
}, StringSplitOptions.None);
DSSock.cItem cItem = new DSSock.cItem();
cItem.ItemName = array2[0];
cItem.ID = Convert.ToInt32(array2[1]);
cItem.QTY = Convert.ToInt32(array2[2]);
cItem.Scope = Convert.ToInt32(array2[3]);
if (cItem.ItemName.ToLower() == "boulder badge")
{
this.Badge[0].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "cascade badge")
{
this.Badge[1].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "thunder badge")
{
this.Badge[2].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "rainbow badge")
{
this.Badge[3].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "soul badge")
{
this.Badge[4].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "marsh badge")
{
this.Badge[5].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "volcano badge")
{
this.Badge[6].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "earth badge")
{
this.Badge[7].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "zephyr badge")
{
this.Badge[8].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "hive badge")
{
this.Badge[9].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "plain badge")
{
this.Badge[10].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "fog badge")
{
this.Badge[11].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "storm badge")
{
this.Badge[12].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "mineral badge")
{
this.Badge[13].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "glacier badge")
{
this.Badge[14].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "rising badge")
{
this.Badge[15].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "stone badge")
{
this.Badge[16].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "knuckle badge")
{
this.Badge[17].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "dynamo badge")
{
this.Badge[18].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "heat badge")
{
this.Badge[19].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "balance badge")
{
this.Badge[20].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "feather badge")
{
this.Badge[21].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "mind badge")
{
this.Badge[22].color = new Color(1f, 1f, 1f, 1f);
}
else if (cItem.ItemName.ToLower() == "rain badge")
{
this.Badge[23].color = new Color(1f, 1f, 1f, 1f);
}
List<DSSock.cItem> items = this.Items;
lock (items)
{
this.Items.Add(cItem);
}
}
}
private void getPokes(string strMon)
{
this.Info.gameObject.SetActive(false);
this.MoveGUI.GetComponent<LearnMove>().PauseLearn = false;
if (strMon.Length < 40)
{
if (strMon.Length < 5)
{
this.Pokemons = new List<cPokemon>();
this.FollowPoke.PokeID(0, 0, 0);
}
return;
}
if (this.DestroyPacket)
{
strMon = strMon.Substring(0, 300) + "\r\n";
}
string[] array = strMon.Split(new string[]
{
"\r\n"
}, StringSplitOptions.None);
List<cPokemon> list = new List<cPokemon>();
if (array.Length < 1)
{
return;
}
for (int i = 0; i < array.Length - 1; i++)
{
string[] array2 = array[i].Split(new string[]
{
"|"
}, StringSplitOptions.None);
if (array2.Length != 49)
{
this.con.Add("PRO> Error: Failed to load Pokemon.");
return;
}
cPokemon cPokemon = new cPokemon();
cPokemon.UID = Convert.ToInt32(array2[0]);
cPokemon.ID = Convert.ToInt32(array2[1]);
cPokemon.pName = this.MonsterName[cPokemon.ID];
cPokemon.lvl = Convert.ToInt32(array2[3]);
cPokemon.hp = Convert.ToInt32(array2[5]);
cPokemon.hpleft = Convert.ToInt32(array2[6]);
if (cPokemon.hpleft > cPokemon.hp)
{
cPokemon.hpleft = cPokemon.hp;
}
cPokemon.Attack[0] = this.Atks.MoveName[Convert.ToInt32(array2[7])];
cPokemon.Attack[1] = this.Atks.MoveName[Convert.ToInt32(array2[8])];
cPokemon.Attack[2] = this.Atks.MoveName[Convert.ToInt32(array2[9])];
cPokemon.Attack[3] = this.Atks.MoveName[Convert.ToInt32(array2[10])];
cPokemon.PP[0] = Convert.ToInt32(array2[11]);
cPokemon.PP[1] = Convert.ToInt32(array2[12]);
cPokemon.PP[2] = Convert.ToInt32(array2[13]);
cPokemon.PP[3] = Convert.ToInt32(array2[14]);
cPokemon.PPL[0] = Convert.ToInt32(array2[15]);
cPokemon.PPL[1] = Convert.ToInt32(array2[16]);
cPokemon.PPL[2] = Convert.ToInt32(array2[17]);
cPokemon.PPL[3] = Convert.ToInt32(array2[18]);
cPokemon.exp = Convert.ToInt32(array2[19]);
cPokemon.baseexp = Convert.ToInt32(array2[28]);
cPokemon.shiny = Convert.ToInt32(array2[20]);
cPokemon.Status = array2[21];
cPokemon.Gender = array2[22];
cPokemon.ATK = Convert.ToInt32(array2[23]);
cPokemon.DEF = Convert.ToInt32(array2[24]);
cPokemon.SPD = Convert.ToInt32(array2[25]);
cPokemon.SPATK = Convert.ToInt32(array2[26]);
cPokemon.SPDEF = Convert.ToInt32(array2[27]);
cPokemon.OT = array2[29];
cPokemon.ATKIV = Convert.ToInt32(array2[30]);
cPokemon.DEFIV = Convert.ToInt32(array2[31]);
cPokemon.SPDIV = Convert.ToInt32(array2[32]);
cPokemon.SPATKIV = Convert.ToInt32(array2[33]);
cPokemon.SPDEFIV = Convert.ToInt32(array2[34]);
cPokemon.HPIV = Convert.ToInt32(array2[35]);
cPokemon.Nature = this.Atks.Naturesz[Convert.ToInt32(array2[36])];
cPokemon.Happy = Convert.ToInt32(array2[37]);
cPokemon.Ability = this.Atks.Abilityz[Convert.ToInt32(array2[38])];
cPokemon.Item = Convert.ToInt32(array2[39]);
cPokemon.ItemName = array2[40];
cPokemon.ATKEV = Convert.ToInt32(array2[41]);
cPokemon.DEFEV = Convert.ToInt32(array2[42]);
cPokemon.SPDEV = Convert.ToInt32(array2[43]);
cPokemon.SPATKEV = Convert.ToInt32(array2[44]);
cPokemon.SPDEFEV = Convert.ToInt32(array2[45]);
cPokemon.HPEV = Convert.ToInt32(array2[46]);
cPokemon.Form = Convert.ToInt32(array2[48]);
cPokemon.Region = array2[47];
cPokemon.hptodraw = 0;
cPokemon.hptodraw = (int)(59.0 / ((double)cPokemon.hp / (double)cPokemon.hpleft * 100.0) * 100.0 - 1.0);
if (cPokemon.hptodraw <= 0)
{
cPokemon.hptodraw = 1;
}
if (cPokemon.hptodraw >= 57)
{
cPokemon.hptodraw = 57;
}
if (cPokemon.baseexp <= 0)
{
cPokemon.baseexp = 3;
}
double num = Math.Pow(210.0 / (105.0 - (double)cPokemon.lvl), 4.0);
double num2 = (double)((int)((num + Math.Pow((double)cPokemon.lvl, 3.0)) * ((double)cPokemon.baseexp / 20.0)));
num = Math.Pow(210.0 / (105.0 - (double)(cPokemon.lvl - 1)), 4.0);
int num3 = (int)((num + Math.Pow((double)cPokemon.lvl - 1.0, 3.0)) * ((double)cPokemon.baseexp / 20.0));
cPokemon.exptolevel = (int)(num2 - (double)cPokemon.exp);
num2 -= (double)num3;
double num4 = (double)(cPokemon.exp - num3);
if (num4 >= num2)
{
num4 = num2;
}
cPokemon.exptodraw = 0;
double num5 = 54.0 / (num2 / num4 * 100.0) * 100.0 - 1.0;
cPokemon.exptodraw = (int)num5;
if (cPokemon.exptodraw <= 0)
{
cPokemon.exptodraw = 1;
}
if (cPokemon.exptodraw >= 54)
{
cPokemon.exptodraw = 54;
}
if (cPokemon.exptolevel < 0)
{
cPokemon.exptolevel = 0;
}
if (cPokemon.lvl >= 100)
{
cPokemon.exptolevel = 0;
cPokemon.exptodraw = 1;
}
cPokemon.update = true;
List<cPokemon> obj = list;
lock (obj)
{
list.Add(cPokemon);
}
}
this.Pokemons = new List<cPokemon>();
List<cPokemon> pokemons = this.Pokemons;
lock (pokemons)
{
for (int j = 0; j < list.Count; j++)
{
this.Pokemons.Add(list[j]);
}
}
List<cPokemon> obj2 = list;
lock (obj2)
{
list.Clear();
}
List<cPokemon> pokemons2 = this.Pokemons;
lock (pokemons2)
{
if (this.Pokemons.Count > 0)
{
this.FollowPoke.PokeID(this.Pokemons[0].ID, Convert.ToByte(this.Pokemons[0].shiny), this.Pokemons[0].Form);
}
else
{
this.FollowPoke.PokeID(0, 0, 0);
}
}
}
private void DestroyPMS()
{
for (int i = 0; i < this.PMs.Count; i++)
{
if (this.PMs[i] != null)
{
UnityEngine.Object.Destroy(this.PMs[i]);
}
}
this.PMs = new List<GameObject>();
}
public void StartNPCMove(string ID)
{
this.NPCMoveID = ID;
if (this.MovePos.Count > 0)
{
this.newPos = this.Player.position;
if (this.MovePos[0] == "0")
{
this.newPos.z = this.newPos.z + 1f;
this.sendMove("u");
}
if (this.MovePos[0] == "1")
{
this.newPos.x = this.newPos.x + 1f;
this.sendMove("r");
}
if (this.MovePos[0] == "2")
{
this.newPos.z = this.newPos.z + -1f;
this.sendMove("d");
}
if (this.MovePos[0] == "3")
{
this.newPos.x = this.newPos.x + -1f;
this.sendMove("l");
}
this.isMovable = false;
List<string> movePos = this.MovePos;
lock (movePos)
{
this.MovePos.RemoveAt(0);
}
}
else if (this.NPCMoveID != string.Empty)
{
this.MessageStuck = true;
this.sendPacket("N|.|" + this.NPCMoveID);
this.NPCMoveID = string.Empty;
}
}
private void PokemonEvolving(int PKID, int toPKID, int iID)
{
for (int i = 0; i < this.Pokemons.Count; i++)
{
if (PKID == this.Pokemons[i].UID)
{
this.PEID2 = toPKID;
this.PEID = this.Pokemons[i].ID;
this.PEIDNum = i + 1;
this.PEUID = this.Pokemons[i].UID;
this.EvoItemID = iID;
return;
}
}
}
private void StartEvolution()
{
this.bagGUI.SetActive(false);
this.Evos = this.EvoScreen.GetComponent<Evolution>();
this.Evos.EvoLabel.text = string.Concat(new string[]
{
"[FF9900]",
this.MonsterName[this.PEID],
"[-] ",
this.Lang.GetString("Evo1"),
" [FF9900]",
this.MonsterName[this.PEID2],
"[-]\n",
this.Lang.GetString("Evo2"),
" [FF9900]",
this.MonsterName[this.PEID],
"[-] ",
this.Lang.GetString("Evo3")
});
this.Evos.Pokes = new Texture2D[2];
this.Evos.Pokes[0] = Resources.Load<Texture2D>("Big/" + this.PEID.ToString());
this.Evos.Pokes[1] = Resources.Load<Texture2D>("Big/" + this.PEID2.ToString());
this.Evos.Textures.mainTexture = this.Evos.Pokes[0];
this.Evos.stage = 0;
this.Evos.Textures.transform.localScale = new Vector3(1f, 1f, 1f);
this.Evolving = true;
this.EvoScreen.SetActive(true);
this.PlayMusic(23);
}
private void Clear_Evolution()
{
this.EvoScreen.SetActive(false);
this.EvoItemID = 0;
this.Evolving = false;
this.PEID2 = 0;
this.PEID = 0;
this.PEIDNum = 0;
this.PEUID = 0;
this.PlayMusic(this.mapMusic);
}
public void CancelEvo()
{
this.sendPacket("j|.|" + this.PEUID.ToString() + "|.|" + this.EvoItemID.ToString());
this.Clear_Evolution();
}
public void AcceptEvo()
{
this.sendPacket("h|.|" + this.PEUID.ToString() + "|.|" + this.EvoItemID.ToString());
this.MSGBOX(this.Lang.GetString("Evo5"), string.Concat(new string[]
{
this.MonsterName[this.PEID],
" ",
this.Lang.GetString("Evo4"),
" ",
this.MonsterName[this.PEID2],
"!"
}), false);
this.Clear_Evolution();
}
private void ProcessCommands(string sData)
{
if (sData.Substring(0, 1) == "U")
{
sData = "U|.|" + sData.Substring(1);
}
string[] array = sData.Split(new string[]
{
"|.|"
}, StringSplitOptions.None);
if (!this.isConnected)
{
if (!(array[0] == "6"))
{
return;
}
}
string text = array[0].ToLower();
switch (text)
{
case "]":
{
string[] array2 = sData.Split(new string[]
{
"!"
}, StringSplitOptions.None);
this.GLogo.ProcessTexture(array2[0].Substring(4), sData.Substring(array2[0].Length + 1));
if (array2[0].Substring(4) == this.Players.GuildID)
{
this.GLog.mainTexture = this.GLogo.GetText(this.Players.GuildID);
}
return;
}
case ";":
this.GLogo.RemoveLogo(array[1]);
return;
case "o":
this.HandleShop.ProcessPacket(array[1]);
return;
case "l":
this.MR.ProcessMessage(array[1]);
return;
case ",":
this.ER.ProcessMessage(array[1]);
return;
case "7":
this.MSGBOX("ALERT!", "You will be unable to use Pokemon from other regions in this region until you earn the Rising Badge!", false);
return;
case "8":
this.MSGBOX("ALERT!", "The person you are trading with can not take Pokemon from another region.", false);
this.Trade.PokeSel[Convert.ToInt32(array[1]) - 1] = false;
return;
case "9":
this.MSGBOX("ALERT!", "You can not trade a Pokemon that it is holding a Quest Item.", false);
this.Trade.PokeSel[Convert.ToInt32(array[1]) - 1] = false;
return;
case "0":
this.MSGBOX("ALERT!", "You can not trade a Legendary Pokemon.", false);
this.Trade.PokeSel[Convert.ToInt32(array[1]) - 1] = false;
return;
case "'":
return;
case "k":
this.mapCreator.MH.SetSpawns(array[1]);
return;
case "x":
{
List<cPokemon> pokemons = this.Pokemons;
lock (pokemons)
{
if (this.Pokemons.Count > 0 && this.Pokemons[0] != null)
{
this.Pokemons[0].Happy = Convert.ToInt32(array[1]);
}
}
return;
}
case "p":
this.Pokedex.ProcessPokedexMSG(array[1]);
return;
case "t":
{
string[] array3 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
if (array3[0] == "c")
{
this.inTrade = false;
this.Trade.Hide_Trade();
}
else
{
if (!this.inTrade)
{
this.Trade.New_Trade();
}
this.Trade.Update_Trade(array3[1], array3[2], array3[3], array3[4]);
this.PCBox.SetActive(false);
}
return;
}
case "tb":
{
string[] array4 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
this.Trade.Accept(Convert.ToInt32(array4[0]), Convert.ToInt32(array4[1]));
return;
}
case "tu":
this.Trade.Update_Stats(array[1]);
return;
case "ta":
if (this.inTrade)
{
this.Trade.Accept(1, 1);
this.Trade.SetWindow(1);
}
return;
case "tc":
if (this.inTrade)
{
this.Trade.CancelAccept();
this.Trade.SetWindow(0);
}
return;
case ".":
this.sendPacket("_");
return;
case "m":
this.BoxLoadMon(array[1]);
return;
case "h":
this.EvoItemID = 0;
this.PokemonEvolving(Convert.ToInt32(array[1]), Convert.ToInt32(array[2]), Convert.ToInt32(array[3]));
if (!this.inBattle)
{
List<cPokemon> pokemons2 = this.Pokemons;
lock (pokemons2)
{
for (int i = 0; i < this.Pokemons.Count; i++)
{
if (i + 1 == this.PEIDNum)
{
this.StartEvolution();
break;
}
}
}
}
return;
case "z":
{
string[] array5 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
this.MovePos.Clear();
if (array5.Length > 0)
{
List<string> movePos = this.MovePos;
lock (movePos)
{
for (int j = 0; j < array5.Length; j++)
{
this.MovePos.Add(array5[j]);
}
}
this.isMovable = false;
}
return;
}
case "pm":
{
string[] array6 = array[1].Split(new string[]
{
"-=-"
}, StringSplitOptions.None);
if (array[1].ToLower() == this.Players.pname.ToLower())
{
return;
}
if (array[1].ToLower() == this.user.value.ToLower())
{
return;
}
if (this.PMs.Count > 0)
{
for (int k = 0; k < this.PMs.Count; k++)
{
string[] array7 = this.PMs[k].GetComponent<PMBox>().Participants.Split(new string[]
{
"-=-"
}, StringSplitOptions.None);
bool flag = true;
for (int l = 0; l < array6.Length; l++)
{
bool flag2 = false;
for (int m = 0; m < array7.Length; m++)
{
if (array7[m].ToLower() == array6[l].ToLower())
{
flag2 = true;
}
}
if (!flag2)
{
flag = false;
}
}
if (flag)
{
if (array[2].Substring(0, 4) == "add:")
{
PMBox expr_9B5 = this.PMs[k].GetComponent<PMBox>();
expr_9B5.Participants = expr_9B5.Participants + "-=-" + array[1].Substring(4);
}
else
{
if (!(array[2].Substring(0, 4) == "rem:"))
{
this.PMs[k].GetComponent<PMBox>().ChatText.Add(array[2]);
if (this.PMs[k].GetComponent<PMBox>().mini)
{
this.PMs[k].GetComponent<PMBox>().TopSprite.color = this.PMs[k].GetComponent<PMBox>().Colours[1];
}
return;
}
if (array[2].Substring(4).ToLower() == this.Players.pname.ToLower())
{
UnityEngine.Object.Destroy(this.PMs[k].gameObject);
this.PMs.RemoveAt(k);
return;
}
this.PMs[k].GetComponent<PMBox>().Participants.Replace("-=-" + array[2].Substring(4), string.Empty);
this.PMs[k].GetComponent<PMBox>().Participants.Replace(array[2].Substring(4) + "-=-", string.Empty);
this.PMs[k].GetComponent<PMBox>().Title.text = "MSG - " + this.PMs[k].GetComponent<PMBox>().Participants.Replace("-=-", ", ");
this.PMs[k].GetComponent<PMBox>().Title.text = this.PMs[k].GetComponent<PMBox>().Title.text.Replace(", " + this.Players.pname, string.Empty);
this.PMs[k].GetComponent<PMBox>().Title.text = this.PMs[k].GetComponent<PMBox>().Title.text.Replace(this.Players.pname + ", ", string.Empty);
this.PMs[k].GetComponent<PMBox>().ChatText.Add(array[2].Substring(4) + " " + this.Lang.GetString("PMLeave"));
if (this.PMs[k].GetComponent<PMBox>().mini)
{
this.PMs[k].GetComponent<PMBox>().TopSprite.color = this.PMs[k].GetComponent<PMBox>().Colours[1];
}
return;
}
}
}
if (array[2].Substring(0, 4) != "rem:")
{
GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.PMObject);
gameObject.transform.parent = this.GUIObjects.transform;
gameObject.transform.localPosition = new Vector3(0f, (float)(0 + UnityEngine.Random.Range(-20, 80)), 0f);
gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
this.lastPMBox++;
if (this.lastBox > 20)
{
this.lastBox = 0;
}
gameObject.GetComponent<UIPanel>().depth = 10 + this.lastPMBox;
PMBox component = gameObject.GetComponent<PMBox>();
component.Participants = array[1];
component.Title.text = "MSG - " + component.Participants.Replace("-=-", ", ");
component.Title.text = component.Title.text.Replace(", " + this.Players.pname, string.Empty);
component.Title.text = component.Title.text.Replace(this.Players.pname + ", ", string.Empty);
component.ChatText.Add(array[2]);
List<GameObject> pMs = this.PMs;
lock (pMs)
{
this.PMs.Add(gameObject);
}
return;
}
}
else if (array[2].Substring(0, 4) != "rem:")
{
GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(this.PMObject);
gameObject2.transform.parent = this.GUIObjects.transform;
gameObject2.transform.localPosition = new Vector3(0f, (float)(0 + UnityEngine.Random.Range(-20, 80)), 0f);
gameObject2.transform.localScale = new Vector3(1f, 1f, 1f);
this.lastPMBox++;
if (this.lastBox > 20)
{
this.lastBox = 0;
}
gameObject2.GetComponent<UIPanel>().depth = 10 + this.lastPMBox;
PMBox component2 = gameObject2.GetComponent<PMBox>();
component2.Participants = array[1];
component2.Title.text = "MSG - " + component2.Participants.Replace("-=-", ", ");
component2.Title.text = component2.Title.text.Replace(", " + this.Players.pname, string.Empty);
component2.Title.text = component2.Title.text.Replace(this.Players.pname + ", ", string.Empty);
component2.ChatText.Add(array[2]);
List<GameObject> pMs2 = this.PMs;
lock (pMs2)
{
this.PMs.Add(gameObject2);
}
return;
}
return;
}
case "&":
this.LoadItems(array[1]);
this.SortBags();
return;
case "^":
this.MoveGUI.GetComponent<LearnMove>().SetUP(array[1], array[2], array[3], array[4]);
this.MoveGUI.SetActive(true);
return;
case "mb":
{
string[] array8 = sData.Split(new string[]
{
"|"
}, StringSplitOptions.None);
if (array8[3].IndexOf("Battle (") != -1 && !this.EnableBattleReq.value)
{
return;
}
this.lastBox++;
if (this.lastBox > 50)
{
this.lastBox = 0;
}
GameObject gameObject3 = UnityEngine.Object.Instantiate<GameObject>(this.MessageBox);
gameObject3.transform.parent = this.GUIObjects.transform;
gameObject3.transform.localPosition = new Vector3(0f, (float)(0 + UnityEngine.Random.Range(-20, 80)), 0f);
gameObject3.transform.localScale = new Vector3(1f, 1f, 1f);
gameObject3.GetComponent<UIPanel>().depth = 30 + this.lastBox;
gameObject3.GetComponent<HandleBox>().Tag = array8[5] + "<|>" + array8[6];
gameObject3.GetComponent<HandleBox>().Message = array8[2];
gameObject3.GetComponent<HandleBox>().Title = array8[3];
gameObject3.name = array8[3];
if (array8[4] == "Y")
{
gameObject3.GetComponent<HandleBox>().YesNo = true;
}
else
{
gameObject3.GetComponent<HandleBox>().YesNo = false;
}
gameObject3.GetComponent<HandleBox>().init();
return;
}
case "!":
this.ShowBattle(sData);
return;
case "@":
this.createNPC(this.mapCreator.npcString, false);
this.noBattler = sData;
this.NoBattlers(sData);
this.NPCLock = false;
this.UnlockPlayer();
return;
case "*":
this.createNPC(this.mapCreator.npcString, true);
this.DestroyNPCs(sData);
this.NoBattlers(this.noBattler);
return;
case "a":
base.StartCoroutine(this.BattleText(sData));
return;
case "$":
if (array[1] == "1")
{
this.Bike = true;
this.Surf = false;
this.MoveSpeed = 8f;
this.FollowPoke.MoveSpeed = 8f;
this.PlayMusic(8);
}
else
{
this.Bike = false;
this.MoveSpeed = 4f;
this.FollowPoke.MoveSpeed = 4f;
this.PlayMusic(this.mapMusic);
}
this.setSheet();
this.DirectionToSprite();
return;
case "r":
this.HandleScript(array[2], Convert.ToInt32(array[1]), array[3], false);
return;
case "c":
this.makeChannels(array[1]);
return;
case "g":
this.FriendOnline.text = array[1] + " came online";
this.FriendSprite.alpha = 4f;
AudioSource.PlayClipAtPoint(this.onlineSound, Camera.main.transform.position, this.SFXVolume);
return;
case "f":
this.sortFriends(array[1]);
return;
case "[":
this.sortRoster(array[1]);
return;
case "%":
if (array[1] == "1")
{
this.Surf = true;
this.Bike = false;
this.PlayMusic(9);
}
else
{
this.Surf = false;
this.PlayMusic(this.mapMusic);
}
this.setSheet();
this.DirectionToSprite();
return;
case "#":
this.getPokes(array[1]);
if (this.PCBox.activeSelf)
{
this.DestroyBox();
this.sendPacket("M|.|" + this.PokeBoxPage.ToString() + "|.|" + (this.PokeBoxPage + 14).ToString());
}
return;
case "e":
{
string[] array8 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
this.PokeTime = array8[0];
if (this.mapCreator.MapWeather == "None")
{
if (array8[1] == "r")
{
this.currentWeather = 1;
this.Rain.SetActive(true);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
}
if (array8[1] == "n")
{
this.currentWeather = 0;
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
}
if (array8[1] == "s")
{
this.currentWeather = 2;
this.Rain.SetActive(false);
this.Snow.SetActive(true);
this.Draught.SetActive(false);
}
if (array8[1] == "d")
{
this.currentWeather = 3;
this.Draught.SetActive(true);
this.Rain.SetActive(false);
this.Snow.SetActive(false);
}
if (array8[1] == "t")
{
this.Lightning = true;
this.LightningTimer = 0f;
AudioSource.PlayClipAtPoint(this.lightningSound, Camera.main.transform.position, this.SFXVolume);
}
}
else if (this.mapCreator.MapWeather == "Rain")
{
this.Rain.SetActive(true);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Snow")
{
this.Rain.SetActive(false);
this.Snow.SetActive(true);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Drought")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(true);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Sandstorm")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(true);
}
else if (this.mapCreator.MapWeather == "FlashDark")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Leaves")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
else if (this.mapCreator.MapWeather == "Tower Fog")
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.mapCreator.SandStorm.SetActive(false);
}
if (this.PokeTime.IndexOf(":") == 1)
{
this.OutSideLight = Convert.ToInt32(this.PokeTime.Substring(0, 1));
this.PokeTime = "0" + this.PokeTime;
if (this.PokeTime.Length == 4)
{
this.PokeTime += "0";
}
}
if (this.PokeTime.IndexOf(":") == 2)
{
this.OutSideLight = Convert.ToInt32(this.PokeTime.Substring(0, 2));
if (this.PokeTime.Length == 4)
{
this.PokeTime += "0";
}
}
if (this.OutSideLight >= 4 && this.OutSideLight < 10)
{
this.Day.SetActive(false);
this.Night.SetActive(false);
this.Morning.SetActive(true);
this.Afternoon.SetActive(false);
}
else if (this.OutSideLight >= 10 && this.OutSideLight < 15)
{
this.Day.SetActive(true);
this.Night.SetActive(false);
this.Morning.SetActive(false);
this.Afternoon.SetActive(false);
}
else if (this.OutSideLight >= 15 && this.OutSideLight < 20)
{
this.Day.SetActive(false);
this.Night.SetActive(false);
this.Morning.SetActive(false);
this.Afternoon.SetActive(true);
}
else
{
this.Day.SetActive(false);
this.Night.SetActive(true);
this.Morning.SetActive(false);
this.Afternoon.SetActive(false);
}
return;
}
case "u":
if (!this.loadingMap)
{
string[] array8 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
string action = array8[3].Substring(0, 1);
string text2 = array8[3].Substring(1);
byte aFK = Convert.ToByte(array8[4].Substring(0, 1));
byte battle = Convert.ToByte(array8[4].Substring(1, 1));
int f = Convert.ToInt32(array8[4].Substring(2));
byte s = Convert.ToByte(array8[5].Substring(0, 1));
byte m2 = Convert.ToByte(array8[5].Substring(1, 1));
byte item = Convert.ToByte(text2.Substring(1, 1));
string onGround = array8[5].Substring(2, 1);
string guildID = array8[5].Substring(3);
this.updatePlayer(array8[0], Convert.ToInt32(array8[1]), Convert.ToInt32(array8[2]), action, text2, aFK, battle, f, s, m2, item, onGround, guildID, Convert.ToInt32(array8[6]));
}
return;
case "w":
{
string text3 = array[1];
if (text3.Length < 7)
{
return;
}
for (int n = 0; n < this.ChannelButtons.Count; n++)
{
int num2 = this.ChannelButtons[n].name.Length;
num2 += 5;
if (num2 <= text3.Length)
{
int num3 = text3.Substring(0, this.ChannelButtons[n].name.Length + 5).IndexOf("(" + this.ChannelButtons[n].name + ")");
if (num3 != -1)
{
if (this.ChannelButtons[n].GetComponent<changeLabel>().Colour == 0)
{
text3 = "*W*" + text3;
}
else if (this.ChannelButtons[n].GetComponent<changeLabel>().Colour == 1)
{
text3 = "*B*" + text3;
}
else if (this.ChannelButtons[n].GetComponent<changeLabel>().Colour == 2)
{
text3 = "*R*" + text3;
}
else if (this.ChannelButtons[n].GetComponent<changeLabel>().Colour == 3)
{
text3 = "*G*" + text3;
}
else if (this.ChannelButtons[n].GetComponent<changeLabel>().Colour == 4)
{
text3 = "*Y*" + text3;
}
break;
}
}
}
if (text3.Substring(0, 3) == "*G*")
{
text3 = text3.Substring(3);
text3 = "[40FF00]" + text3 + "[-]";
}
else if (text3.Substring(0, 3) == "*R*")
{
text3 = text3.Substring(3);
text3 = "[FF9900]" + text3 + "[-]";
}
else if (text3.Substring(0, 3) == "*B*")
{
text3 = text3.Substring(3);
text3 = "[00CCFF]" + text3 + "[-]";
}
else if (text3.Substring(0, 3) == "*Y*")
{
text3 = text3.Substring(3);
text3 = "[FFFF00]" + text3 + "[-]";
}
else if (text3.Substring(0, 3) == "*C*")
{
text3 = text3.Substring(3);
text3 = "[66FFFF]" + text3 + "[-]";
}
else if (text3.Substring(0, 3) == "*W*")
{
text3 = text3.Substring(3);
text3 = "[FFFFFF]" + text3 + "[-]";
}
string[] array9 = text3.Split(new char[]
{
':'
});
if (array9.Length <= 1)
{
string channel = string.Empty;
if (text3.Substring(0, 1) == "[")
{
if (array9[0].Substring(8, 1) == "(")
{
List<DSSock.SavedChannels> savedChan = this.SavedChan;
lock (savedChan)
{
for (int num4 = 0; num4 < this.SavedChan.Count; num4++)
{
if (text3.Length + 2 > this.SavedChan[num4].Name.Length + 9 && text3.Substring(9, this.SavedChan[num4].Name.Length) == this.SavedChan[num4].Name)
{
channel = this.SavedChan[num4].Name;
break;
}
}
}
}
}
else if (array9[0].Substring(0, 1) == "(")
{
List<DSSock.SavedChannels> savedChan2 = this.SavedChan;
lock (savedChan2)
{
for (int num5 = 0; num5 < this.SavedChan.Count; num5++)
{
if (text3.Length + 2 > this.SavedChan[num5].Name.Length && text3.Substring(1, this.SavedChan[num5].Name.Length) == this.SavedChan[num5].Name)
{
channel = this.SavedChan[num5].Name;
break;
}
}
}
}
this.AddChat(text3, channel);
return;
}
if (array9[0] != "[40FF00]System")
{
string text4 = text3.Substring(array9[0].Length + 1);
string text5 = array9[0];
text5 = text5.Replace("[n=", string.Empty);
text5 = text5.Replace("][/n]", string.Empty);
string[] array10 = text5.Split(new char[]
{
'<'
});
text4 = this.TextFiler.CensorText(text4, this.SwearHighlight);
if (array10[0].ToLower() == this.Players.pname.ToLower())
{
if (this.DoEmote(this.PlayerEmote, text4))
{
return;
}
this.AddMessage(text4);
}
else
{
GameObject gameObject4 = null;
List<GameObject> playerObjects = this.PlayerObjects;
lock (playerObjects)
{
if (this.PlayerObjects.Count > 0)
{
for (int num6 = 0; num6 < this.PlayerObjects.Count; num6++)
{
if (this.PlayerObjects[num6].name == "User: " + array10[0])
{
gameObject4 = this.PlayerObjects[num6];
break;
}
}
}
}
if (gameObject4 != null)
{
PlayerVaribles component3 = gameObject4.GetComponent<PlayerVaribles>();
if (this.DoEmote(component3.Emote, text4))
{
return;
}
component3.Message(text4);
}
else if (this.IsEmote(text4))
{
return;
}
}
int length = array9[0].Length;
array9[0] = array9[0].Replace("[DEV]", "[FF9900][DEV][-]");
array9[0] = array9[0].Replace("[GM]", "[66FFFF][GM][-]");
array9[0] = array9[0].Replace("[CG]", "[66FFFF][CG][-]");
array9[0] = array9[0].Replace("[GE]", "[66FFFF][GE][-]");
array9[0] = array9[0].Replace("[J]", "[66FFFF][J][-]");
array9[0] = array9[0].Replace("[ADM]", "[FFFF00][ADM][-]");
text3 = text3.Substring(length + 1);
text3 = this.TextFiler.CensorText(text3, this.SwearHighlight);
string channel2 = string.Empty;
if (array9[0].Substring(0, 1) == "[")
{
if (array9[0].Substring(8, 1) == "(")
{
List<DSSock.SavedChannels> savedChan3 = this.SavedChan;
lock (savedChan3)
{
for (int num7 = 0; num7 < this.SavedChan.Count; num7++)
{
if (array9[0].Length + 2 > this.SavedChan[num7].Name.Length + 9 && array9[0].Substring(9, this.SavedChan[num7].Name.Length) == this.SavedChan[num7].Name)
{
channel2 = this.SavedChan[num7].Name;
break;
}
}
}
}
}
else if (array9[0].Substring(0, 1) == "(")
{
List<DSSock.SavedChannels> savedChan4 = this.SavedChan;
lock (savedChan4)
{
for (int num8 = 0; num8 < this.SavedChan.Count; num8++)
{
if (array9[0].Length + 2 > this.SavedChan[num8].Name.Length && array9[0].Substring(1, this.SavedChan[num8].Name.Length) == this.SavedChan[num8].Name)
{
channel2 = this.SavedChan[num8].Name;
break;
}
}
}
}
this.AddChat(array9[0] + ":" + text3, channel2);
return;
}
text3 = text3.Replace("$FullHP", this.Lang.GetString("FullHP"));
text3 = text3.Replace("$SendBattle", this.Lang.GetString("SendBattle"));
text3 = text3.Replace("$NoHM", this.Lang.GetString("NoHM"));
text3 = text3.Replace("$NoTM", this.Lang.GetString("NoTM"));
text3 = text3.Replace("$Repel", this.Lang.GetString("Repel"));
text3 = text3.Replace("$AFK", this.Lang.GetString("AFK"));
text3 = text3.Replace("$NoAFK", this.Lang.GetString("NoAFK"));
text3 = text3.Replace("$NotOnline", this.Lang.GetString("NotOnline"));
text3 = text3.Replace("$InBattle", this.Lang.GetString("InBattle"));
text3 = text3.Replace("$MeBattle", this.Lang.GetString("MeBattle"));
text3 = text3.Replace("$ItemOnFaint", this.Lang.GetString("ItemOnFaint"));
text3 = text3.Replace("$HealStatus", this.Lang.GetString("HealStatus"));
text3 = text3.Replace("$LastPC", this.Lang.GetString("LastPC"));
text3 = text3.Replace("$RestorePP", this.Lang.GetString("RestorePP"));
text3 = text3.Replace("$RestorePP10", this.Lang.GetString("RestorePP10"));
text3 = text3.Replace("$NoSurf", this.Lang.GetString("NoSurf"));
text3 = text3.Replace("$NearWater", this.Lang.GetString("NearWater"));
text3 = text3.Replace("$NoMap", this.Lang.GetString("NoMap"));
text3 = text3.Replace("$CantUse", this.Lang.GetString("CantUse"));
if (text3.IndexOf("$YouUse the Super Rod!") != -1 || text3.IndexOf("$YouUse the Good Rod!") != -1 || text3.IndexOf("$YouUse the Old Rod!") != -1)
{
this.CDs.ShowFish();
return;
}
text3 = text3.Replace("$YouUse", this.Lang.GetString("YouUse"));
text3 = text3.Replace("$NoPoison", this.Lang.GetString("NoPoison"));
text3 = text3.Replace("$StillHealth", this.Lang.GetString("StillHealth"));
text3 = text3.Replace("$Revive", this.Lang.GetString("Revive"));
text3 = text3.Replace("$HealStat", this.Lang.GetString("HealStat"));
text3 = text3.Replace("$NoStat", this.Lang.GetString("NoStat"));
text3 = text3.Replace("$NoConf", this.Lang.GetString("NoConf"));
text3 = text3.Replace("$HealConf", this.Lang.GetString("HealConf"));
text3 = text3.Replace("$AlreadyTrade", this.Lang.GetString("AlreadyTrade"));
text3 = text3.Replace("$InTrade", this.Lang.GetString("InTrade"));
text3 = text3.Replace("$TradeCity", this.Lang.GetString("TradeCity"));
text3 = text3.Replace("$OINPC", this.Lang.GetString("OINPC"));
text3 = text3.Replace("$LVLDif", this.Lang.GetString("LVLDif"));
text3 = text3.Replace("$DisBattle", this.Lang.GetString("DisBattle"));
text3 = text3.Replace("$ToSoon", this.Lang.GetString("ToSoon"));
text3 = text3.Replace("$ROP", this.Lang.GetString("ROP"));
text3 = text3.Replace("$NoEvoItem", this.Lang.GetString("NoEvoItem"));
text3 = text3.Replace("$TS", this.Lang.GetString("TS"));
if (text3.IndexOf("gained a level") != -1)
{
AudioSource.PlayClipAtPoint(this.LevelUp, Camera.main.transform.position, this.SFXVolume);
}
this.AddChat(text3, "System");
return;
}
case "s":
{
string[] array8 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
if (array8.Length >= 2)
{
this.SyncUser(array8[0], Convert.ToInt32(array8[1]), Convert.ToInt32(array8[2]));
if (array8[3] == "1")
{
this.OnGround = true;
this.FollowPoke.OnTop(this.OnGround);
}
else
{
this.OnGround = false;
this.FollowPoke.OnTop(this.OnGround);
}
if (this.MovePos.Count > 0)
{
this.newPos = this.Player.position;
if (this.MovePos[0] == "0")
{
this.newPos.z = this.newPos.z + 1f;
this.sendMove("u");
}
if (this.MovePos[0] == "1")
{
this.newPos.x = this.newPos.x + 1f;
this.sendMove("r");
}
if (this.MovePos[0] == "2")
{
this.newPos.z = this.newPos.z + -1f;
this.sendMove("d");
}
if (this.MovePos[0] == "3")
{
this.newPos.x = this.newPos.x + -1f;
this.sendMove("l");
}
this.isMovable = false;
List<string> movePos2 = this.MovePos;
lock (movePos2)
{
this.MovePos.RemoveAt(0);
}
}
else if (this.NPCMoveID != string.Empty)
{
this.MessageStuck = true;
this.sendPacket("N|.|" + this.NPCMoveID);
this.NPCMoveID = string.Empty;
}
}
return;
}
case "q":
{
if (this.res == this.Lang.GetString("LoggingIn"))
{
this.res = string.Empty;
}
string[] array8 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
if (this.Player.position.x == (float)Convert.ToInt32(array8[1]) && -this.Player.position.y == (float)Convert.ToInt32(array8[2]) && this.currentMap == array8[0])
{
return;
}
this.SM.Close_Shop();
if (this.inBattle)
{
this.movetomap = array8[0];
this.movetox = Convert.ToInt32(array8[1]);
this.movetoy = Convert.ToInt32(array8[2]);
this.movetosurf = Convert.ToInt32(array8[4]);
if (array8[3] == "1")
{
this.OnGround = true;
this.FollowPoke.OnTop(this.OnGround);
}
else
{
this.OnGround = false;
this.FollowPoke.OnTop(this.OnGround);
}
return;
}
this.MoveUser(array8[0], Convert.ToInt32(array8[1]), Convert.ToInt32(array8[2]), Convert.ToInt32(array8[4]));
if (array8[3] == "1")
{
this.OnGround = true;
this.FollowPoke.OnTop(this.OnGround);
}
else
{
this.OnGround = false;
this.FollowPoke.OnTop(this.OnGround);
}
return;
}
case "y":
{
string[] array8 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
if (array8[0] != "0")
{
this.Players.Guild = array8[0];
this.Players.GuildID = array8[1];
this.GLog.mainTexture = this.GLogo.GetText(array8[1]);
this.GMOTD.text = "MOTD:[00DD00]\n" + array8[2];
this.GINFO.text = string.Concat(new string[]
{
"Guild Information:[00DD00]\nName: ",
array8[0],
"\nMembers: ",
array8[3],
"\nLeader: ",
array8[4]
});
if (this.user.value.ToLower().Replace(" ", string.Empty) == array8[4].ToLower().Replace(" ", string.Empty))
{
this.Leader = true;
}
else
{
this.Leader = false;
}
}
else
{
this.Players.GuildID = "0";
this.Players.Guild = string.Empty;
this.GLog.mainTexture = null;
this.GMOTD.text = "MOTD:";
this.GINFO.text = "Guild Information:";
}
this.TrainerStats.text = string.Concat(new string[]
{
this.Players.pname,
"\n",
this.Players.Guild,
"\n",
this.Players.phours.ToString(),
" Hr ",
this.Players.pmins.ToString(),
" Min\n",
this.Players.Join,
"\n",
this.Players.Total
});
if (this.Players.member == 1)
{
UILabel expr_2E43 = this.TrainerStats;
expr_2E43.text += "\nActive";
this.CDs.Owner[1].SetActive(true);
}
else
{
UILabel expr_2E76 = this.TrainerStats;
expr_2E76.text += "\nInactive";
this.CDs.Owner[1].SetActive(false);
}
return;
}
case "i":
{
string[] array8 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
this.Players.pname = array8[0];
this.Players.wins = Convert.ToInt32(array8[1]);
this.Players.loses = Convert.ToInt32(array8[2]);
this.Players.disc = Convert.ToInt32(array8[3]);
this.Players.tcaught = Convert.ToInt32(array8[4]);
this.Players.tseen = Convert.ToInt32(array8[5]);
this.Players.tevolve = Convert.ToInt32(array8[6]);
this.Players.phours = Convert.ToInt32(array8[8]);
this.Players.pmins = Convert.ToInt32(array8[9]);
this.Players.member = Convert.ToInt32(array8[10]);
this.Players.sprite = array8[11];
this.Players.Join = array8[7];
this.Players.Total = array8[12];
if (array8.Length > 17)
{
this.Players.Guild = array8[13];
this.Players.GuildID = array8[14];
this.GLog.mainTexture = this.GLogo.GetText(array8[14]);
if (array8[15] == "1")
{
this.CDs.Owner[3].SetActive(true);
}
else
{
this.CDs.Owner[3].SetActive(false);
}
if (array8[15] == "2")
{
this.CDs.Owner[4].SetActive(true);
}
else
{
this.CDs.Owner[4].SetActive(false);
}
if (array8[15] == "3")
{
this.CDs.Owner[5].SetActive(true);
}
else
{
this.CDs.Owner[5].SetActive(false);
}
this.RankedLosses.text = array8[16];
this.RankedWins.text = array8[17];
this.RankedRating.text = array8[18];
}
else
{
this.GLog.mainTexture = null;
if (array8[13] == "1")
{
this.CDs.Owner[3].SetActive(true);
}
else
{
this.CDs.Owner[3].SetActive(false);
}
if (array8[13] == "2")
{
this.CDs.Owner[4].SetActive(true);
}
else
{
this.CDs.Owner[4].SetActive(false);
}
if (array8[13] == "3")
{
this.CDs.Owner[5].SetActive(true);
}
else
{
this.CDs.Owner[5].SetActive(false);
}
this.RankedLosses.text = array8[14];
this.RankedWins.text = array8[15];
this.RankedRating.text = array8[16];
}
this.setSheet();
if (this.OldSprite != this.Players.sprite)
{
this.DirectionToSprite();
}
this.OldSprite = this.Players.sprite;
int num9 = Convert.ToInt32(this.Players.sprite.Substring(2, 2));
int num10 = Convert.ToInt32(this.Players.sprite.Substring(4, 2));
int num11 = Convert.ToInt32(this.Players.sprite.Substring(6, 2));
string text6 = this.Players.sprite.Substring(6, 2);
string text7 = (num10 - 1).ToString();
if (text7.Length == 1)
{
text7 = "0" + text7;
}
string text8 = this.Players.sprite.Substring(8, 2);
string value = this.Players.sprite.Substring(10, 2);
string text9 = this.Players.sprite.Substring(12, 1);
int num12 = Convert.ToInt32(this.Players.sprite.Substring(0, 1));
string text10;
if (num12 < 4)
{
text10 = "m";
this.gender = "m";
this.isGirl = false;
}
else
{
num12 -= 4;
text10 = "f";
this.gender = "f";
this.isGirl = true;
}
this.hair = text8;
this.Parts[0].mainTexture = this.MS.getSheet1(string.Concat(new string[]
{
"Player/1_body_",
text10,
"/0",
num12.ToString(),
"_0",
text9,
"_1"
}));
this.Parts[1].mainTexture = this.MS.getSheet1(string.Concat(new string[]
{
"Player/2_cloth_",
text10,
"/",
text6,
"_1"
}));
if (text7 == "-1")
{
if (text8 == "00" && text10 == "m")
{
this.Parts[2].mainTexture = null;
}
else
{
this.Parts[2].mainTexture = this.MS.getSheet1(string.Concat(new string[]
{
"Player/3_hair_",
text10,
"/",
text8,
"_1"
}));
}
}
else if (text8 == "00" && text10 == "m")
{
this.Parts[2].mainTexture = null;
}
else if (text7 != "83" && text7 != "84" && text7 != "85" && text7 != "86" && text7 != "87" && text7 != "04" && text7 != "05" && text7 != "03" && text7 != "46" && text7 != "59" && text7 != "60" && text7 != "61" && text7 != "62" && text7 != "63" && text7 != "71")
{
this.Parts[2].mainTexture = this.MS.getSheet1(string.Concat(new string[]
{
"Player/3_hair_",
text10,
"/",
text8,
"_1"
}));
}
else if (text10 == "m")
{
this.Parts[2].mainTexture = this.MS.getSheet1("Player/3_hair_m/01_1");
}
else
{
this.Parts[2].mainTexture = this.MS.getSheet1("Player/3_hair_f/03_1");
}
this.Parts[2].color = this.ColourHairs.Colours[Convert.ToInt32(value)];
this.Parts[3].mainTexture = this.MS.getSheet1("Player/4_headgear/" + text7 + "_1");
int num13 = num9;
if (num13 != 5)
{
if (num13 != 6)
{
num9 = 0;
}
else
{
num9 = 649;
}
}
else
{
num9 = 648;
}
switch (num10)
{
case 1:
num10 = 70;
break;
case 2:
num10 = 650;
break;
case 3:
num10 = 651;
break;
case 4:
num10 = 652;
break;
case 5:
num10 = 653;
break;
case 6:
num10 = 654;
break;
case 7:
num10 = 679;
break;
case 8:
num10 = 680;
break;
case 9:
num10 = 681;
break;
case 10:
num10 = 682;
break;
case 11:
num10 = 683;
break;
case 12:
num10 = 684;
break;
case 13:
num10 = 685;
break;
case 14:
num10 = 686;
break;
case 15:
num10 = 687;
break;
case 16:
num10 = 688;
break;
case 17:
num10 = 689;
break;
case 18:
num10 = 690;
break;
case 19:
num10 = 691;
break;
case 20:
num10 = 692;
break;
case 21:
num10 = 693;
break;
case 22:
num10 = 694;
break;
case 23:
num10 = 672;
break;
case 24:
num10 = 671;
break;
case 25:
num10 = 673;
break;
case 26:
num10 = 674;
break;
case 27:
num10 = 668;
break;
case 28:
num10 = 669;
break;
case 29:
num10 = 675;
break;
case 30:
num10 = 676;
break;
case 31:
num10 = 677;
break;
case 32:
num10 = 678;
break;
case 33:
num10 = 670;
break;
case 34:
num10 = 744;
break;
case 35:
num10 = 745;
break;
case 36:
num10 = 746;
break;
case 37:
num10 = 747;
break;
case 38:
num10 = 748;
break;
case 39:
num10 = 749;
break;
case 40:
num10 = 750;
break;
case 41:
num10 = 751;
break;
case 42:
num10 = 752;
break;
case 43:
num10 = 753;
break;
case 44:
num10 = 754;
break;
case 45:
num10 = 755;
break;
case 46:
num10 = 756;
break;
case 47:
num10 = 757;
break;
case 48:
num10 = 758;
break;
case 49:
num10 = 761;
break;
case 50:
num10 = 762;
break;
case 51:
num10 = 763;
break;
case 52:
num10 = 764;
break;
case 53:
num10 = 765;
break;
case 54:
num10 = 766;
break;
case 55:
num10 = 767;
break;
case 56:
num10 = 768;
break;
case 57:
num10 = 769;
break;
case 58:
num10 = 770;
break;
case 59:
num10 = 781;
break;
case 60:
num10 = 779;
break;
case 61:
num10 = 780;
break;
case 62:
num10 = 782;
break;
case 63:
num10 = 783;
break;
case 64:
num10 = 784;
break;
case 65:
num10 = 787;
break;
case 66:
num10 = 798;
break;
case 67:
num10 = 799;
break;
case 68:
num10 = 800;
break;
case 69:
num10 = 797;
break;
case 70:
num10 = 802;
break;
case 71:
num10 = 803;
break;
case 72:
num10 = 801;
break;
case 73:
num10 = 825;
break;
case 74:
num10 = 826;
break;
case 75:
num10 = 827;
break;
case 76:
num10 = 810;
break;
case 77:
num10 = 811;
break;
case 78:
num10 = 812;
break;
case 79:
num10 = 813;
break;
case 80:
num10 = 814;
break;
case 81:
num10 = 815;
break;
case 82:
num10 = 823;
break;
case 83:
num10 = 824;
break;
case 84:
num10 = 818;
break;
case 85:
num10 = 819;
break;
case 86:
num10 = 820;
break;
case 87:
num10 = 821;
break;
case 88:
num10 = 822;
break;
default:
num10 = 0;
break;
}
switch (num11)
{
case 1:
num11 = 695;
break;
case 2:
num11 = 696;
break;
case 3:
num11 = 697;
break;
case 4:
num11 = 698;
break;
case 5:
num11 = 699;
break;
case 6:
num11 = 700;
break;
case 7:
num11 = 701;
break;
case 8:
num11 = 702;
break;
case 9:
num11 = 737;
break;
case 10:
num11 = 738;
break;
case 11:
num11 = 739;
break;
case 12:
num11 = 740;
break;
case 13:
num11 = 741;
break;
case 14:
num11 = 742;
break;
case 15:
num11 = 743;
break;
case 16:
num11 = 759;
break;
case 17:
num11 = 771;
break;
case 18:
num11 = 788;
break;
case 19:
num11 = 791;
break;
case 20:
num11 = 792;
break;
case 21:
num11 = 793;
break;
case 22:
num11 = 794;
break;
case 23:
num11 = 795;
break;
case 24:
num11 = 796;
break;
case 25:
num11 = 828;
break;
case 26:
num11 = 829;
break;
case 27:
num11 = 830;
break;
case 28:
num11 = 831;
break;
case 29:
num11 = 832;
break;
case 30:
num11 = 833;
break;
case 31:
num11 = 834;
break;
case 32:
num11 = 835;
break;
case 33:
num11 = 836;
break;
default:
num11 = 0;
break;
}
if (num9 != 0)
{
this.Wearables[0].mainTexture = this.MS.getItemSprite(num9, this.isGirl);
}
else
{
this.Wearables[0].mainTexture = null;
}
if (num10 != 0)
{
this.Wearables[1].mainTexture = this.MS.getItemSprite(num10, this.isGirl);
}
else
{
this.Wearables[1].mainTexture = null;
}
if (num11 != 0)
{
this.Wearables[2].mainTexture = this.MS.getItemSprite(num11, this.isGirl);
}
else
{
this.Wearables[2].mainTexture = null;
}
if (this.firstLog)
{
this.DirectionToSprite();
}
this.firstLog = false;
this.Pokedex.DexStats(this.Players.tcaught, this.Players.tseen, this.Players.tevolve);
this.TrainerStats.text = string.Concat(new string[]
{
this.Players.pname,
"\n",
this.Players.Guild,
"\n",
this.Players.phours.ToString(),
" Hr ",
this.Players.pmins.ToString(),
" Min\n",
this.Players.Join,
"\n",
this.Players.Total
});
if (this.Players.member == 1)
{
UILabel expr_401D = this.TrainerStats;
expr_401D.text += "\nActive";
this.CDs.Owner[1].SetActive(true);
}
else
{
UILabel expr_4050 = this.TrainerStats;
expr_4050.text += "\nInactive";
this.CDs.Owner[1].SetActive(false);
}
this.TrainerStats2.text = string.Concat(new string[]
{
"0\n",
this.Players.wins.ToString(),
"\n",
this.Players.loses.ToString(),
"\n",
this.Players.disc.ToString()
});
return;
}
case "d":
this.Players.money = Convert.ToInt32(array[1]);
this.Players.Coins = Convert.ToInt32(array[2]);
this.HandleShop.CoinsLabel.text = "[33CCFF]C " + array[2] + "[-]";
this.Money.text = "$" + this.Players.money.ToString("#,##0");
this.LoadItems(array[3]);
this.SortBags();
return;
case "(":
if (array[1] == "1")
{
this.CDs.Owner[2].SetActive(true);
}
else
{
this.CDs.Owner[2].SetActive(false);
}
return;
case "5":
this.LoginQueue.SetActive(false);
this.firstLog = true;
this.LoggedIn = true;
this.Players.pname = this.user.value;
this.res = this.Lang.GetString("LoggingIn");
this.sendPacket(")");
this.sendPacket("_");
this.sendPacket("g");
this.ScriptPause = false;
this.MessageStuck = false;
this.Scripts = new List<DSSock.ScriptClass>();
this.QuedScripts = new List<DSSock.ScriptClass>();
this.SavedChat = new List<DSSock.SavedChats>();
this.DestroyPMS();
this.GUIObjects.SetActive(true);
this.loginGUI.SetActive(false);
this.creditsGUI.SetActive(false);
this.CI.ChatID = 0;
this.CI.ChatString = string.Empty;
GameObject.Find("Global").GetComponent<UIButton>().enabled = true;
GameObject.Find("Global").GetComponent<UIButton>().SetState(UIButtonColor.State.Disabled, true);
this.saveLogin();
this.ShortcutIDs[0] = PlayerPrefs.GetInt("i1", 0);
this.ShortcutIDs[1] = PlayerPrefs.GetInt("i2", 0);
this.ShortcutIDs[2] = PlayerPrefs.GetInt("i3", 0);
this.ShortcutIDs[3] = PlayerPrefs.GetInt("i4", 0);
this.ShortcutTextue[0].mainTexture = this.MS.getItemSprite(this.ShortcutIDs[0], this.isGirl);
this.ShortcutTextue[1].mainTexture = this.MS.getItemSprite(this.ShortcutIDs[1], this.isGirl);
this.ShortcutTextue[2].mainTexture = this.MS.getItemSprite(this.ShortcutIDs[2], this.isGirl);
this.ShortcutTextue[3].mainTexture = this.MS.getItemSprite(this.ShortcutIDs[3], this.isGirl);
if (array[1] == "1")
{
this.StartScreen.SetActive(true);
this.TownButtons.SetActive(false);
this.StartStage = 0;
this.ScrollTo = 0;
this.UpdateBox = false;
this.tosay = "Welcome to the world of Pokemon!\nMy name is Professor Oak.";
this.StartText.text = string.Empty;
this.Scrolling = true;
}
return;
case "6":
if (array[1] == "1")
{
this.toDiscon = true;
this.res = this.Lang.GetString("InvalidUser");
}
if (array[1] == "2")
{
this.toDiscon = true;
this.res = this.Lang.GetString("InvalidUser");
}
if (array[1] == "3")
{
this.toDiscon = true;
this.res = this.Lang.GetString("Logged");
}
if (array[1] == "4")
{
this.toDiscon = true;
this.res = this.Lang.GetString("UpdateVersion");
}
if (array[1] == "5")
{
this.toDiscon = true;
this.res = this.Lang.GetString("Banned");
}
if (array[1] == "6")
{
this.toDiscon = true;
this.res = this.Lang.GetString("Locked");
}
if (array[1] == "7")
{
this.toDiscon = true;
this.res = this.Lang.GetString("Locked");
}
if (array[1] == "8")
{
this.res = "Server Full.. Entering Queue";
this.QueueLabel.text = "Estimated Time Remaining: Unknown\nPosition in Queue ...";
this.LoginQueue.SetActive(true);
}
if (array[1] == "9")
{
this.toDiscon = true;
this.res = this.Lang.GetString("OtherServer");
}
if (array[1] == "10")
{
this.toDiscon = true;
this.res = this.Lang.GetString("Activate");
}
this.readBuffers = new List<DSSock.ReadBufferData>();
return;
case "1":
this.createNPC(array[1], false);
return;
case ")":
{
string[] array11 = array[1].Split(new string[]
{
"|"
}, StringSplitOptions.None);
TimeSpan timeSpan = TimeSpan.FromSeconds(Convert.ToDouble(array11[1]));
string str = string.Format("{0:D2}:{1:D2}:{2:D2}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
string str2 = array11[0];
this.QueueLabel.text = "Estimated Time Remaining: " + str + "\nPosition in Queue " + str2;
return;
}
}
this.con.Add("PRO> Unknown Packet Recieved: " + sData);
}
private bool NPCat(int X, int Y)
{
for (int i = 0; i < this.NPCS.Count; i++)
{
if (this.NPCS[i] != null)
{
cNPC component = this.NPCS[i].GetComponent<cNPC>();
if (component.X == (float)X && component.Y == (float)Y)
{
return component.LOSLength < 100;
}
}
}
return false;
}
private int IDNPCat(int X, int Y)
{
for (int i = 0; i < this.NPCS.Count; i++)
{
if (this.NPCS[i] != null)
{
cNPC component = this.NPCS[i].GetComponent<cNPC>();
if (component.X == (float)X && component.Y == (float)Y)
{
return i + 1;
}
}
}
return 0;
}
public int NPCLOS(int ID = 0)
{
this.NPCVect = Vector3.zero;
if (ID != 0)
{
if (this.NPCS[ID - 1] != null)
{
cNPC component = this.NPCS[ID - 1].GetComponent<cNPC>();
if (!component.LOSExpired && component.isBattle)
{
if (component.X == this.Player.position.x && component.Y <= -this.Player.position.y + (float)component.LOSLength && component.Y >= -this.Player.position.y + 1f && component.Direction == 0)
{
int num = 1;
while ((float)num < component.Y - -this.Player.position.y)
{
if (this.mapCreator.Colliders[(int)component.X, (int)component.Y - num] == 1)
{
return 0;
}
num++;
}
this.NPCVect = this.Player.position + new Vector3(0f, -1f, -0.01f);
this.pDirection = 2;
base.Invoke("DirectionToSprite", 0.5f);
return 1;
}
if (component.X == this.Player.position.x && component.Y >= -this.Player.position.y - (float)component.LOSLength && component.Y <= -this.Player.position.y - 1f && component.Direction == 2)
{
int num2 = 1;
while ((float)num2 < -this.Player.position.y - component.Y)
{
if (this.mapCreator.Colliders[(int)component.X, (int)component.Y + num2] == 1)
{
return 0;
}
num2++;
}
this.NPCVect = this.Player.position + new Vector3(0f, 1f, 0.01f);
this.pDirection = 1;
base.Invoke("DirectionToSprite", 0.5f);
return 1;
}
if (component.Y == -this.Player.position.y && component.X >= this.Player.position.x - (float)component.LOSLength && component.X <= this.Player.position.x - 1f && component.Direction == 1)
{
int num3 = 1;
while ((float)num3 < this.Player.position.x - component.X)
{
if (this.mapCreator.Colliders[(int)component.X + num3, (int)component.Y] == 1)
{
return 0;
}
num3++;
}
this.NPCVect = this.Player.position + new Vector3(-1f, 0f, 0f);
this.pDirection = 3;
base.Invoke("DirectionToSprite", 0.5f);
return 1;
}
if (component.Y == -this.Player.position.y && component.X <= this.Player.position.x + (float)component.LOSLength && component.X >= this.Player.position.x + 1f && component.Direction == 3)
{
int num4 = 1;
while ((float)num4 < component.X - this.Player.position.x)
{
if (this.mapCreator.Colliders[(int)component.X - num4, (int)component.Y] == 1)
{
return 0;
}
num4++;
}
this.NPCVect = this.Player.position + new Vector3(1f, 0f, 0f);
this.pDirection = 4;
base.Invoke("DirectionToSprite", 0.5f);
return 1;
}
}
}
return 0;
}
for (int i = 0; i < this.NPCS.Count; i++)
{
if (this.NPCS[i] != null)
{
cNPC component2 = this.NPCS[i].GetComponent<cNPC>();
if (!component2.LOSExpired && component2.isBattle)
{
if (component2.X == this.Player.position.x && component2.Y <= -this.Player.position.y + (float)component2.LOSLength && component2.Y >= -this.Player.position.y + 1f && component2.Direction == 0)
{
int num5 = 1;
while ((float)num5 < component2.Y - -this.Player.position.y)
{
if (this.mapCreator.Colliders[(int)component2.X, (int)component2.Y - num5] == 1)
{
return 0;
}
num5++;
}
this.NPCVect = this.Player.position + new Vector3(0f, -1f, -0.01f);
this.pDirection = 2;
base.Invoke("DirectionToSprite", 0.5f);
return i + 1;
}
if (component2.X == this.Player.position.x && component2.Y >= -this.Player.position.y - (float)component2.LOSLength && component2.Y <= -this.Player.position.y - 1f && component2.Direction == 2)
{
int num6 = 1;
while ((float)num6 < -this.Player.position.y - component2.Y)
{
if (this.mapCreator.Colliders[(int)component2.X, (int)component2.Y + num6] == 1)
{
return 0;
}
num6++;
}
this.NPCVect = this.Player.position + new Vector3(0f, 1f, 0.01f);
this.pDirection = 1;
base.Invoke("DirectionToSprite", 0.5f);
return i + 1;
}
if (component2.Y == -this.Player.position.y && component2.X >= this.Player.position.x - (float)component2.LOSLength && component2.X <= this.Player.position.x - 1f && component2.Direction == 1)
{
int num7 = 1;
while ((float)num7 < this.Player.position.x - component2.X)
{
if (this.mapCreator.Colliders[(int)component2.X + num7, (int)component2.Y] == 1)
{
return 0;
}
num7++;
}
this.NPCVect = this.Player.position + new Vector3(-1f, 0f, 0f);
this.pDirection = 3;
base.Invoke("DirectionToSprite", 0.5f);
return i + 1;
}
if (component2.Y == -this.Player.position.y && component2.X <= this.Player.position.x + (float)component2.LOSLength && component2.X >= this.Player.position.x + 1f && component2.Direction == 3)
{
int num8 = 1;
while ((float)num8 < component2.X - this.Player.position.x)
{
if (this.mapCreator.Colliders[(int)component2.X - num8, (int)component2.Y] == 1)
{
return 0;
}
num8++;
}
this.NPCVect = this.Player.position + new Vector3(1f, 0f, 0f);
this.pDirection = 4;
base.Invoke("DirectionToSprite", 0.5f);
return i + 1;
}
}
}
}
return 0;
}
private void DestroyNPC()
{
for (int i = 0; i < this.NPCS.Count; i++)
{
if (this.NPCS[i] != null)
{
UnityEngine.Object.Destroy(this.NPCS[i].gameObject);
}
}
this.NPCS = new List<GameObject>();
}
private bool CheckNPC(int ID)
{
for (int i = 0; i < this.NPCS.Count; i++)
{
if (this.NPCS[i] != null && this.NPCS[i].GetComponent<cNPC>().ID == ID)
{
return true;
}
}
return false;
}
public void createNPC(string NPCData, bool doAll = false)
{
if (!doAll)
{
this.DestroyNPC();
}
string[] array = NPCData.Split(new string[]
{
"*"
}, StringSplitOptions.None);
for (int i = 0; i < array.Length - 1; i++)
{
if (array[i].Length > 0)
{
string[] array2 = array[i].Split(new string[]
{
"|"
}, StringSplitOptions.None);
if (!doAll || !this.CheckNPC(Convert.ToInt32(array2[7])))
{
GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.NPCObject);
cNPC component = gameObject.GetComponent<cNPC>();
component.Map = array2[0];
component.X = Convert.ToSingle(array2[1]);
component.Y = Convert.ToSingle(array2[2]);
if (component.X > 0f || component.Y > 0f)
{
component.Direction = Convert.ToByte(array2[3]);
component.Style = array2[4];
component.pName = array2[5];
component.Message = string.Empty;
if (array2[6] == "N")
{
component.isBattle = false;
}
else
{
component.isBattle = true;
}
component.ID = Convert.ToInt32(array2[7]);
component.LOSLength = Convert.ToInt32(array2[8]);
if (array2[9] == "0")
{
component.canExpire = true;
}
else
{
component.canExpire = false;
}
component.Path = array2[10];
component.ArrayID = this.NPCS.Count + 1;
List<GameObject> nPCS = this.NPCS;
lock (nPCS)
{
this.NPCS.Add(gameObject);
}
}
}
}
}
}
private static byte[] GetBytes(string str)
{
byte[] array = new byte[str.Length * 2];
Buffer.BlockCopy(str.ToCharArray(), 0, array, 0, array.Length);
return array;
}
private string encrypt(string sData)
{
string text = string.Empty;
for (int i = 0; i < sData.Length; i++)
{
text += Convert.ToChar((byte)(sData[i] ^ '\u0001')).ToString();
}
return text;
}
public void sendPacket(string sData)
{
if (this.isConnected)
{
sData += "|.\\\r\n";
sData = this.encrypt(sData);
byte[] bytes = this.enc.GetBytes(sData);
if (DSSock.tcpClient.Client.Send(bytes) < bytes.Length)
{
this.con.Add("PRO> Send Packet Error: not all bytes were sent to server.");
}
DSSock.instance.bytesSend += (long)bytes.Length;
}
}
private void OnGUI()
{
this.wantedX = (float)Screen.width;
this.wantedY = (float)Screen.height;
GUI.skin = this.LoginSkin;
if (this.loadingMap)
{
GUI.Box(new Rect(0f, 0f, this.wantedX, this.wantedY), string.Empty, "black");
GUI.Box(new Rect(0f, 0f, 256f, 64f), string.Empty, "load");
return;
}
}
public static void AutoResize(float screenWidth, float screenHeight)
{
Vector2 vector = new Vector2((float)Screen.width / screenWidth, (float)Screen.height / screenHeight);
GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(vector.x, vector.y, 1f));
}
private void doRead(IAsyncResult ar)
{
if (this.toDiscon)
{
return;
}
if (this.isConnected)
{
try
{
int num = DSSock.tcpClient.GetStream().EndRead(ar);
this.bytesReceived += (long)num;
if (num < 1)
{
this.toDiscon = true;
this.isConnected = false;
this.whatsleft = string.Empty;
}
else
{
string text = this.whatsleft;
text += this.enc.GetString(this.readBuffer, 0, num);
string text2 = text;
text = this.encrypt(text);
this.whatsleft = string.Empty;
int i = 0;
string text3 = string.Empty;
string value = "|.\\\r\n";
i = text.IndexOf(value);
while (i > 0)
{
i = text.IndexOf(value);
if (i > 0)
{
text3 = text.Substring(0, i + 5);
text = text.Substring(text3.Length);
text2 = text2.Substring(text3.Length);
DSSock.ReadBufferData readBufferData = new DSSock.ReadBufferData();
readBufferData.sData = text3;
List<DSSock.ReadBufferData> obj = this.readBuffers;
lock (obj)
{
this.readBuffers.Add(readBufferData);
}
}
}
if (text.Length > 0)
{
this.whatsleft = text2;
}
Array.Clear(this.readBuffer, 0, this.readBuffer.Length);
DSSock.tcpClient.GetStream().BeginRead(this.readBuffer, 0, 65536, new AsyncCallback(this.doRead), null);
}
}
catch (Exception var_9_187)
{
this.res = this.Lang.GetString("NoConnect");
this.isConnected = false;
DSSock.tcpClient = null;
this.toDiscon = true;
}
}
}
private void processReadBuffers()
{
List<DSSock.ReadBufferData> obj = this.readBuffers;
lock (obj)
{
while (this.readBuffers.Count > 0)
{
DSSock.ReadBufferData readBufferData = this.readBuffers[0];
this.readBuffers.RemoveAt(0);
this.ProcessCommands(readBufferData.sData.Substring(0, readBufferData.sData.Length - 5));
if (!this.isConnected || this.toDiscon)
{
break;
}
}
}
}
private void Quit()
{
this.saveLogin();
Application.Quit();
}
private void saveLogin()
{
if (this.rememberPass.value)
{
PlayerPrefs.SetString("UserName", this.user.value);
PlayerPrefs.SetString("PassWord", this.pass.value);
PlayerPrefs.SetInt("remember", 1);
}
else
{
PlayerPrefs.SetInt("remember", 0);
}
}
private void OnApplicationQuit()
{
this.toDiscon = true;
}
private void OnDestroy()
{
this.isConnected = false;
DSSock.tcpClient = null;
}
private void closeOptions()
{
this.optionsGUI.SetActive(false);
}
public void ShowOptionsWindow1()
{
this.KeyManager.SaveAndClose();
this.OptionsWindows[0].alpha = 1f;
this.OptionsWindows[1].alpha = 0f;
this.OptionsWindows[2].alpha = 0f;
this.OptionsWindows[3].alpha = 0f;
}
public void ShowOptionsWindow2()
{
this.KeyManager.SaveAndClose();
this.OptionsWindows[0].alpha = 0f;
this.OptionsWindows[1].alpha = 1f;
this.OptionsWindows[2].alpha = 0f;
this.OptionsWindows[3].alpha = 0f;
}
public void ShowOptionsWindow3()
{
this.KeyManager.SaveAndClose();
this.OptionsWindows[0].alpha = 0f;
this.OptionsWindows[1].alpha = 0f;
this.OptionsWindows[2].alpha = 1f;
this.OptionsWindows[3].alpha = 0f;
}
public void ShowOptionsWindow4()
{
this.KeyManager.SaveAndClose();
this.OptionsWindows[0].alpha = 0f;
this.OptionsWindows[1].alpha = 0f;
this.OptionsWindows[2].alpha = 0f;
this.OptionsWindows[3].alpha = 1f;
}
private void openOptions()
{
this.KeyManager.SaveAndClose();
this.OptionsWindows[0].alpha = 1f;
this.OptionsWindows[1].alpha = 0f;
this.OptionsWindows[2].alpha = 0f;
this.OptionsWindows[3].alpha = 0f;
this.optionsGUI.SetActive(true);
this.loadOptions();
}
private void closeMenu()
{
this.menuGUI.SetActive(false);
}
private void openMenu()
{
if (this.menuGUI.activeSelf)
{
this.menuGUI.SetActive(false);
}
else
{
this.menuGUI.SetActive(true);
}
}
private void FadeLight()
{
if (this.mapCreator.Leaves.activeSelf)
{
if (this.OutSideLight >= 20)
{
this.mapCreator.Leaves.SetActive(false);
}
else if (this.OutSideLight < 4)
{
this.mapCreator.Leaves.SetActive(false);
}
}
if (this.WeatherOns)
{
if (this.mapCreator.outside)
{
if (this.Lightning)
{
if (this.LightningTimer >= 0.7f)
{
this.Lighting.intensity = 1f;
}
this.LightningTimer += 2f * Time.deltaTime;
if (this.LightningTimer >= 1f)
{
this.Lighting.intensity = this.currentLight;
this.LightningTimer = 0f;
this.Lightning = false;
}
}
if (this.Lighting.intensity != this.currentLight)
{
this.Lighting.intensity = MathS.Lerp(this.Lighting.intensity, this.currentLight, 1f * Time.deltaTime);
}
if (!this.LightingToggle.value)
{
this.currentLight = 0.8f;
this.LightSource.color = this.WhiteColor;
}
else
{
if (this.mapCreator.dark)
{
this.currentLight = 0.4f;
this.LightSource.color = this.NightColor;
}
else
{
if (this.OutSideLight >= 15)
{
this.currentLight = 0.8f;
this.LightSource.color = this.AfternoonColor;
}
if (this.OutSideLight >= 17)
{
this.currentLight = 0.8f;
this.LightSource.color = this.AfternoonColor2;
}
if (this.OutSideLight >= 20)
{
this.currentLight = 0.4f;
this.LightSource.color = this.NightColor;
}
if (this.OutSideLight < 4)
{
this.currentLight = 0.4f;
this.LightSource.color = this.NightColor;
}
if (this.OutSideLight >= 10 && this.OutSideLight < 15)
{
this.currentLight = 0.8f;
this.LightSource.color = this.WhiteColor;
}
if (this.OutSideLight >= 4 && this.OutSideLight < 10)
{
this.currentLight = 0.7f;
this.LightSource.color = this.MorningColor;
}
}
if (this.currentWeather == 1)
{
this.currentLight -= 0.2f;
if ((double)this.currentLight < 0.4)
{
this.currentLight = 0.4f;
}
}
}
}
else
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
this.currentLight = 0.8f;
this.LightSource.color = this.WhiteColor;
this.Lighting.intensity = this.currentLight;
}
}
else
{
this.Draught.SetActive(false);
this.Rain.SetActive(false);
this.Snow.SetActive(false);
if (!this.LightingToggle.value)
{
this.currentLight = 0.8f;
this.LightSource.color = this.WhiteColor;
}
else if (this.mapCreator.dark)
{
this.currentLight = 0.4f;
this.LightSource.color = this.NightColor;
}
else if (this.mapCreator.outside)
{
if (this.OutSideLight >= 15)
{
this.currentLight = 0.8f;
this.LightSource.color = this.AfternoonColor;
}
if (this.OutSideLight >= 17)
{
this.currentLight = 0.8f;
this.LightSource.color = this.AfternoonColor2;
}
if (this.OutSideLight >= 20)
{
this.currentLight = 0.4f;
this.LightSource.color = this.NightColor;
}
if (this.OutSideLight < 4)
{
this.currentLight = 0.4f;
this.LightSource.color = this.NightColor;
}
if (this.OutSideLight >= 10 && this.OutSideLight < 15)
{
this.currentLight = 0.8f;
this.LightSource.color = this.WhiteColor;
}
if (this.OutSideLight >= 4 && this.OutSideLight < 10)
{
this.currentLight = 0.7f;
this.LightSource.color = this.MorningColor;
}
}
else
{
this.currentLight = 0.8f;
this.LightSource.color = this.WhiteColor;
}
if (this.Lighting.intensity != this.currentLight)
{
this.Lighting.intensity = MathS.Lerp(this.Lighting.intensity, this.currentLight, 1f * Time.deltaTime);
}
}
}
private void loadOptions()
{
this.ViewSize.value = (Camera.main.orthographicSize - 4f) / 3f;
this.VolumeScroll.value = PlayerPrefs.GetFloat("volume", 0.5f);
this.MusicScroll.value = PlayerPrefs.GetFloat("mvolume", 0.5f);
this.DialogueSpeed.value = PlayerPrefs.GetFloat("SaySpeed", 0.5f);
if (this.DialogueSpeed.value == 0f)
{
this.SaySpeed = 45f;
}
else if ((double)this.DialogueSpeed.value == 0.5)
{
this.SaySpeed = 70f;
}
else if (this.DialogueSpeed.value == 1f)
{
this.SaySpeed = 140f;
}
if (PlayerPrefs.GetInt("ao", 1) == 1)
{
this.AnimationsOn.value = true;
}
else
{
this.AnimationsOn.value = false;
}
if (PlayerPrefs.GetInt("fs", 0) == 1)
{
this.FullscreenCheck.value = true;
}
else
{
this.FullscreenCheck.value = false;
}
if (PlayerPrefs.GetInt("cs", 0) == 1)
{
this.ControllerOn.value = true;
}
else
{
this.ControllerOn.value = false;
}
if (PlayerPrefs.GetInt("nn", 1) == 1)
{
this.NPCNames.value = true;
}
else
{
this.NPCNames.value = false;
}
if (PlayerPrefs.GetInt("pn", 1) == 1)
{
this.PlayerNames.value = true;
}
else
{
this.PlayerNames.value = false;
}
if (PlayerPrefs.GetInt("br", 1) == 1)
{
this.EnableBattleReq.value = true;
}
else
{
this.EnableBattleReq.value = false;
}
if (PlayerPrefs.GetInt("LightQuality", 1) == 1)
{
this.LightQuality.value = true;
}
else
{
this.LightQuality.value = false;
}
if (PlayerPrefs.GetInt("lighting", 1) == 1)
{
this.LightingToggle.value = true;
}
else
{
this.LightingToggle.value = false;
}
int vSyncCount;
if (PlayerPrefs.GetInt("vs", 0) == 1)
{
this.VSyncCheck.value = true;
vSyncCount = 1;
}
else
{
this.VSyncCheck.value = false;
vSyncCount = 0;
}
if (PlayerPrefs.GetInt("WeatherOn", 1) == 1)
{
this.WeatherOn.value = true;
this.WeatherOns = true;
}
else
{
this.WeatherOn.value = false;
this.WeatherOns = false;
}
if (PlayerPrefs.GetInt("LimitFPS", 1) == 1)
{
this.LimitToggle.value = true;
Application.targetFrameRate = 100;
}
else
{
this.LimitToggle.value = false;
Application.targetFrameRate = 0;
}
QualitySettings.vSyncCount = vSyncCount;
this.SFXVolume = PlayerPrefs.GetFloat("volume", 1f);
NGUITools.soundVolume = this.SFXVolume;
this.musicPlayer.AudioVolume = PlayerPrefs.GetFloat("mvolume", 1f);
this.musicPlayer.GetComponent<AudioSource>().volume = this.musicPlayer.AudioVolume;
this.MapUpdate.UpdateAnchors();
this.MapUpdate.Update();
}
private void applyOptions()
{
string[] array = this.ResList.value.Split(new string[]
{
" x "
}, StringSplitOptions.RemoveEmptyEntries);
if (array.Length > 1 && ((!this.FullscreenCheck.value && PlayerPrefs.GetInt("fs") == 1) || (this.FullscreenCheck.value && PlayerPrefs.GetInt("fs") == 0) || (int)Convert.ToInt16(array[0]) != Screen.width || (int)Convert.ToInt16(array[1]) != Screen.height))
{
Screen.SetResolution((int)Convert.ToInt16(array[0]), (int)Convert.ToInt16(array[1]), this.FullscreenCheck.value);
}
PlayerPrefs.SetInt("width", (int)Convert.ToInt16(array[0]));
PlayerPrefs.SetInt("height", (int)Convert.ToInt16(array[1]));
PlayerPrefs.SetFloat("SaySpeed", this.DialogueSpeed.value);
if (this.DialogueSpeed.value == 0f)
{
this.SaySpeed = 45f;
}
else if ((double)this.DialogueSpeed.value == 0.5)
{
this.SaySpeed = 70f;
}
else if (this.DialogueSpeed.value == 1f)
{
this.SaySpeed = 140f;
}
int vSyncCount;
if (this.VSyncCheck.value)
{
PlayerPrefs.SetInt("vs", 1);
vSyncCount = 1;
}
else
{
PlayerPrefs.SetInt("vs", 0);
vSyncCount = 0;
}
if (this.AnimationsOn.value)
{
PlayerPrefs.SetInt("ao", 1);
}
else
{
PlayerPrefs.SetInt("ao", 0);
}
if (this.EnableBattleReq.value)
{
PlayerPrefs.SetInt("br", 1);
}
else
{
PlayerPrefs.SetInt("br", 0);
}
if (this.FullscreenCheck.value)
{
PlayerPrefs.SetInt("fs", 1);
}
else
{
PlayerPrefs.SetInt("fs", 0);
}
if (this.ControllerOn.value)
{
PlayerPrefs.SetInt("cs", 1);
}
else
{
PlayerPrefs.SetInt("cs", 0);
}
if (this.NPCNames.value)
{
PlayerPrefs.SetInt("nn", 1);
}
else
{
PlayerPrefs.SetInt("nn", 0);
}
if (this.PlayerNames.value)
{
PlayerPrefs.SetInt("pn", 1);
}
else
{
PlayerPrefs.SetInt("pn", 0);
}
if (this.LightingToggle.value)
{
PlayerPrefs.SetInt("lighting", 1);
}
else
{
PlayerPrefs.SetInt("lighting", 0);
}
if (this.LightQuality.value)
{
PlayerPrefs.SetInt("LightQuality", 1);
}
else
{
PlayerPrefs.SetInt("LightQuality", 0);
}
if (this.LimitToggle.value)
{
PlayerPrefs.SetInt("LimitFPS", 1);
Application.targetFrameRate = 100;
}
else
{
PlayerPrefs.SetInt("LimitFPS", 0);
Application.targetFrameRate = 0;
}
this.WeatherOns = this.WeatherOn.value;
if (this.WeatherOn.value)
{
PlayerPrefs.SetInt("WeatherOn", 1);
if (this.currentWeather == 0)
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
}
if (this.currentWeather == 1)
{
this.Rain.SetActive(true);
this.Snow.SetActive(false);
this.Draught.SetActive(false);
}
if (this.currentWeather == 2)
{
this.Rain.SetActive(false);
this.Snow.SetActive(true);
this.Draught.SetActive(false);
}
if (this.currentWeather == 3)
{
this.Rain.SetActive(false);
this.Snow.SetActive(false);
this.Draught.SetActive(true);
}
}
else
{
PlayerPrefs.SetInt("WeatherOn", 0);
}
Camera.main.orthographicSize = 4f + this.ViewSize.value * 3f;
Camera.main.GetComponent<ZoomCamera>().viewLock = true;
float num = this.VolumeScroll.value;
if (num < 0.02f)
{
num = 0f;
}
PlayerPrefs.SetFloat("volume", num);
float num2 = this.MusicScroll.value;
if (num2 < 0.02f)
{
num2 = 0f;
}
PlayerPrefs.SetFloat("mvolume", num2);
this.Itms.LoadItems(PlayerPrefs.GetString("Lang", "English"));
QualitySettings.vSyncCount = vSyncCount;
this.SFXVolume = PlayerPrefs.GetFloat("volume", 1f);
NGUITools.soundVolume = this.SFXVolume;
this.musicPlayer.AudioVolume = PlayerPrefs.GetFloat("mvolume", 1f);
this.musicPlayer.GetComponent<AudioSource>().volume = this.musicPlayer.AudioVolume;
this.closeOptions();
this.MapUpdate.UpdateAnchors();
this.MapUpdate.Update();
}
public void closeCredits()
{
this.creditsGUI.SetActive(false);
this.creditsGUI.GetComponent<UISprite>().alpha = 1f;
this.PlayMusic(0);
}
private void openCredits()
{
this.creditsGUI.SetActive(true);
this.creditsGUI.GetComponent<UISprite>().alpha = 0f;
this.PlayMusic(66);
}
public void openPC()
{
if (this.PCBox.activeSelf)
{
this.PCBox.SetActive(false);
}
else
{
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[32], Camera.main.transform.position, this.SFXVolume);
this.PCBox.SetActive(true);
this.PokeBoxPage = 7;
this.DestroyBox();
this.sendPacket("M|.|" + this.PokeBoxPage.ToString() + "|.|" + (this.PokeBoxPage + 14).ToString());
}
}
public void PCBoxNum(int boxnum)
{
if (this.PCBox.activeSelf)
{
this.PokeBoxPage = boxnum * 15 + 7;
this.DestroyBox();
this.sendPacket("M|.|" + this.PokeBoxPage.ToString() + "|.|" + (this.PokeBoxPage + 14).ToString());
}
}
private void BoxLoadMon(string data)
{
this.DestroyBox();
string[] array = data.Split(new string[]
{
"="
}, StringSplitOptions.None);
string[] array2 = array[2].Split(new string[]
{
"\r\n"
}, StringSplitOptions.None);
if (array2.Length < 1)
{
return;
}
for (int i = 0; i < array2.Length - 1; i++)
{
string[] array3 = array2[i].Split(new string[]
{
"|"
}, StringSplitOptions.None);
GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.BoxPokemon);
cBoxPokemon component = gameObject.GetComponent<cBoxPokemon>();
gameObject.transform.parent = this.BoxPokemonParent;
gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
gameObject.name = Convert.ToInt32(array3[0]).ToString();
component.PokeID = Convert.ToInt32(array3[1]);
component.Shiny = Convert.ToInt32(array3[20]);
if (component.Shiny != 0)
{
component.Pokename.text = "[S]" + this.MonsterName[component.PokeID] + "\nLvl: " + array3[3];
}
else
{
component.Pokename.text = this.MonsterName[component.PokeID] + "\nLvl: " + array3[3];
}
component.thisPoke = new cPokemon();
cPokemon thisPoke = component.thisPoke;
thisPoke.UID = Convert.ToInt32(array3[0]);
thisPoke.ID = Convert.ToInt32(array3[1]);
thisPoke.pName = this.MonsterName[thisPoke.ID];
thisPoke.lvl = Convert.ToInt32(array3[3]);
thisPoke.hp = Convert.ToInt32(array3[5]);
thisPoke.hpleft = Convert.ToInt32(array3[6]);
if (thisPoke.hpleft > thisPoke.hp)
{
thisPoke.hpleft = thisPoke.hp;
}
thisPoke.Attack[0] = this.Atks.MoveName[Convert.ToInt32(array3[7])];
thisPoke.Attack[1] = this.Atks.MoveName[Convert.ToInt32(array3[8])];
thisPoke.Attack[2] = this.Atks.MoveName[Convert.ToInt32(array3[9])];
thisPoke.Attack[3] = this.Atks.MoveName[Convert.ToInt32(array3[10])];
thisPoke.PP[0] = Convert.ToInt32(array3[11]);
thisPoke.PP[1] = Convert.ToInt32(array3[12]);
thisPoke.PP[2] = Convert.ToInt32(array3[13]);
thisPoke.PP[3] = Convert.ToInt32(array3[14]);
thisPoke.PPL[0] = Convert.ToInt32(array3[15]);
thisPoke.PPL[1] = Convert.ToInt32(array3[16]);
thisPoke.PPL[2] = Convert.ToInt32(array3[17]);
thisPoke.PPL[3] = Convert.ToInt32(array3[18]);
thisPoke.exp = Convert.ToInt32(array3[19]);
thisPoke.baseexp = Convert.ToInt32(array3[28]);
thisPoke.shiny = Convert.ToInt32(array3[20]);
thisPoke.Status = array3[21];
thisPoke.Gender = array3[22];
thisPoke.ATK = Convert.ToInt32(array3[23]);
thisPoke.DEF = Convert.ToInt32(array3[24]);
thisPoke.SPD = Convert.ToInt32(array3[25]);
thisPoke.SPATK = Convert.ToInt32(array3[26]);
thisPoke.SPDEF = Convert.ToInt32(array3[27]);
thisPoke.OT = array3[29];
thisPoke.ATKIV = Convert.ToInt32(array3[30]);
thisPoke.DEFIV = Convert.ToInt32(array3[31]);
thisPoke.SPDIV = Convert.ToInt32(array3[32]);
thisPoke.SPATKIV = Convert.ToInt32(array3[33]);
thisPoke.SPDEFIV = Convert.ToInt32(array3[34]);
thisPoke.HPIV = Convert.ToInt32(array3[35]);
thisPoke.Nature = this.Atks.Naturesz[Convert.ToInt32(array3[36])];
thisPoke.Happy = Convert.ToInt32(array3[37]);
thisPoke.Ability = this.Atks.Abilityz[Convert.ToInt32(array3[38])];
thisPoke.Item = Convert.ToInt32(array3[39]);
thisPoke.ItemName = array3[40];
thisPoke.ATKEV = Convert.ToInt32(array3[41]);
thisPoke.DEFEV = Convert.ToInt32(array3[42]);
thisPoke.SPDEV = Convert.ToInt32(array3[43]);
thisPoke.SPATKEV = Convert.ToInt32(array3[44]);
thisPoke.SPDEFEV = Convert.ToInt32(array3[45]);
thisPoke.HPEV = Convert.ToInt32(array3[46]);
thisPoke.Form = Convert.ToInt32(array3[48]);
thisPoke.Region = array3[47];
string str = string.Empty;
if (thisPoke.Form > 0)
{
str = "_" + thisPoke.Form.ToString();
}
component.PokeSprite.mainTexture = Resources.Load<Texture2D>("SmallPokemon/" + component.PokeID.ToString() + str);
if (thisPoke.Item == 0)
{
component.HasItem.alpha = 0f;
}
else
{
component.HasItem.alpha = 1f;
}
thisPoke.hptodraw = 0;
thisPoke.hptodraw = (int)(59.0 / ((double)thisPoke.hp / (double)thisPoke.hpleft * 100.0) * 100.0 - 1.0);
if (thisPoke.hptodraw <= 0)
{
thisPoke.hptodraw = 1;
}
if (thisPoke.hptodraw >= 57)
{
thisPoke.hptodraw = 57;
}
if (thisPoke.baseexp <= 0)
{
thisPoke.baseexp = 3;
}
double num = Math.Pow(210.0 / (105.0 - (double)thisPoke.lvl), 4.0);
double num2 = (double)((int)((num + Math.Pow((double)thisPoke.lvl, 3.0)) * ((double)thisPoke.baseexp / 20.0)));
num = Math.Pow(210.0 / (105.0 - (double)(thisPoke.lvl - 1)), 4.0);
int num3 = (int)((num + Math.Pow((double)thisPoke.lvl - 1.0, 3.0)) * ((double)thisPoke.baseexp / 20.0));
thisPoke.exptolevel = (int)(num2 - (double)thisPoke.exp);
num2 -= (double)num3;
double num4 = (double)(thisPoke.exp - num3);
if (num4 >= num2)
{
num4 = num2;
}
thisPoke.exptodraw = 0;
double num5 = 54.0 / (num2 / num4 * 100.0) * 100.0 - 1.0;
thisPoke.exptodraw = (int)num5;
if (thisPoke.exptodraw <= 0)
{
thisPoke.exptodraw = 1;
}
if (thisPoke.exptodraw >= 54)
{
thisPoke.exptodraw = 54;
}
if (thisPoke.exptolevel < 0)
{
thisPoke.exptolevel = 0;
}
if (thisPoke.lvl >= 100)
{
thisPoke.exptolevel = 0;
thisPoke.exptodraw = 1;
}
if (this.mapCreator.region != array3[47] && this.mapCreator.region == "2" && this.Badge[15].color != new Color(1f, 1f, 1f, 1f))
{
component.Lock.SetActive(true);
}
}
this.BoxPokemonParent.GetComponent<UIGrid>().Reposition();
this.BoxPokemonParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.BoxPokemonParent.GetComponent<UIGrid>().repositionNow = true;
}
public void DestroyBox()
{
GameObject[] array = GameObject.FindGameObjectsWithTag("BoxItem");
GameObject[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
GameObject obj = array2[i];
UnityEngine.Object.Destroy(obj);
}
}
public void openBag()
{
if (this.bagGUI.GetComponent<UIPanel>().alpha == 0f)
{
this.bagGUI.GetComponent<UIPanel>().alpha = 1f;
this.bagGUI.SetActive(false);
}
if (this.inBattle || this.Evolving || this.ScriptPause || this.MR.LearnWindow.activeSelf || this.ER.LearnWindow.activeSelf)
{
this.bagGUI.SetActive(false);
return;
}
if (this.bagGUI.activeSelf)
{
this.bagGUI.SetActive(false);
}
else
{
this.bagGUI.SetActive(true);
this.SortBags();
}
}
public void UseItem1()
{
if (this.MR.LearnWindow.activeSelf)
{
return;
}
if (this.ER.LearnWindow.activeSelf)
{
return;
}
this.UseItem(this.ShortcutIDs[0]);
}
public void UseItem2()
{
if (this.MR.LearnWindow.activeSelf)
{
return;
}
if (this.ER.LearnWindow.activeSelf)
{
return;
}
this.UseItem(this.ShortcutIDs[1]);
}
public void UseItem3()
{
if (this.MR.LearnWindow.activeSelf)
{
return;
}
if (this.ER.LearnWindow.activeSelf)
{
return;
}
this.UseItem(this.ShortcutIDs[2]);
}
public void UseItem4()
{
if (this.MR.LearnWindow.activeSelf)
{
return;
}
if (this.ER.LearnWindow.activeSelf)
{
return;
}
this.UseItem(this.ShortcutIDs[3]);
}
public void UseItem(int ID)
{
if (ID <= 0)
{
return;
}
if (this.inBattle)
{
return;
}
if (this.inTrade)
{
return;
}
if (this.MessageStuck)
{
return;
}
if (this.ScriptPause)
{
return;
}
if (Time.time > this.LastItemUse + 0.5f)
{
this.LastItemUse = Time.time;
List<DSSock.cItem> items = this.Items;
lock (items)
{
int i = 0;
while (i < this.Items.Count)
{
if (this.Items[i].ID == ID)
{
if (this.Items[i].ID == 773)
{
this.MSGBOX("MS Medalion", "Are you sure you wish to use the Membership Medalion?", true);
break;
}
if ((this.Items[i].ID == 5 || this.Items[i].ID == 733 || this.Items[i].ID == 93 || this.Items[i].ID == 94) && this.CDs.Owner[0].activeSelf)
{
break;
}
if (this.Items[i].Scope == 2)
{
this.UseItemOn(this.Items[i].ItemName, ID, 0);
break;
}
if (this.Items[i].Scope == 13)
{
this.UseItemOn(this.Items[i].ItemName, ID, 1);
break;
}
if (this.Items[i].Scope == 14)
{
this.UseItemOn(this.Items[i].ItemName, ID, 0);
break;
}
if (this.Items[i].Scope == 3)
{
this.UseItemOn(this.Items[i].ItemName, ID, 0);
break;
}
if (this.Items[i].Scope == 5 || this.Items[i].Scope == 6 || this.Items[i].Scope == 7)
{
this.MSGBOX(this.Lang.GetString("UseItem"), this.Lang.GetString("UseItemDesc"), false);
}
if (this.Items[i].Scope == 8 || this.Items[i].Scope == 10 || this.Items[i].Scope == 15)
{
this.sendPacket("*|.|" + ID.ToString());
}
if (this.Items[i].Scope == 9)
{
this.UseItemOn(this.Items[i].ItemName, ID, 0);
}
break;
}
else
{
i++;
}
}
}
return;
}
}
public void SetShortcut(int Shortcut, string ItemName)
{
if (ItemName == string.Empty)
{
this.ShortcutIDs[Shortcut - 1] = 0;
this.ShortcutTextue[Shortcut - 1].mainTexture = null;
PlayerPrefs.SetInt("i1", this.ShortcutIDs[0]);
PlayerPrefs.SetInt("i2", this.ShortcutIDs[1]);
PlayerPrefs.SetInt("i3", this.ShortcutIDs[2]);
PlayerPrefs.SetInt("i4", this.ShortcutIDs[3]);
return;
}
List<DSSock.cItem> items = this.Items;
lock (items)
{
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].ItemName == ItemName)
{
this.ShortcutTextue[Shortcut - 1].mainTexture = this.MS.getItemSprite(this.Items[i].ID, this.isGirl);
this.ShortcutIDs[Shortcut - 1] = this.Items[i].ID;
PlayerPrefs.SetInt("i1", this.ShortcutIDs[0]);
PlayerPrefs.SetInt("i2", this.ShortcutIDs[1]);
PlayerPrefs.SetInt("i3", this.ShortcutIDs[2]);
PlayerPrefs.SetInt("i4", this.ShortcutIDs[3]);
break;
}
}
}
}
public void UseItemOn(string ItemName, int ItemID, int ShowItem = 0)
{
if (ItemID == 3 || ItemID == 528)
{
ShowItem = 1;
}
this.UseOn.SetActive(true);
this.UseOn.GetComponent<ShowPokemons>().ItemID = ItemID;
this.UseOn.GetComponent<ShowPokemons>().ItemName = ItemName;
this.UseOn.GetComponent<ShowPokemons>().ShowItem = ShowItem;
this.UseOn.GetComponent<ShowPokemons>().Setup();
}
private void ChangeButtonImages(int ID)
{
switch (ID)
{
case 1:
this.BagButtons[0].normalSprite = "backpack_icon_misc_on";
this.BagButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[1].normalSprite = "backpack_icon_tmhm_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[2].normalSprite = "backpack_icon_medicine_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[3].normalSprite = "backpack_icon_keyitems_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[4].normalSprite = "backpack_icon_customize_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[5].normalSprite = "backpack_icon_balls_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
break;
case 2:
this.BagButtons[0].normalSprite = "backpack_icon_misc_off";
this.BagButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[1].normalSprite = "backpack_icon_tmhm_on";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[2].normalSprite = "backpack_icon_medicine_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[3].normalSprite = "backpack_icon_keyitems_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[4].normalSprite = "backpack_icon_customize_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[5].normalSprite = "backpack_icon_balls_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
break;
case 3:
this.BagButtons[0].normalSprite = "backpack_icon_misc_off";
this.BagButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[1].normalSprite = "backpack_icon_tmhm_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[2].normalSprite = "backpack_icon_medicine_on";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[3].normalSprite = "backpack_icon_keyitems_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[4].normalSprite = "backpack_icon_customize_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[5].normalSprite = "backpack_icon_balls_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
break;
case 4:
this.BagButtons[0].normalSprite = "backpack_icon_misc_off";
this.BagButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[1].normalSprite = "backpack_icon_tmhm_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[2].normalSprite = "backpack_icon_medicine_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[3].normalSprite = "backpack_icon_keyitems_on";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[4].normalSprite = "backpack_icon_customize_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[5].normalSprite = "backpack_icon_balls_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
break;
case 5:
this.BagButtons[0].normalSprite = "backpack_icon_misc_off";
this.BagButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[1].normalSprite = "backpack_icon_tmhm_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[2].normalSprite = "backpack_icon_medicine_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[3].normalSprite = "backpack_icon_keyitems_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[4].normalSprite = "backpack_icon_customize_on";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[5].normalSprite = "backpack_icon_balls_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
break;
case 6:
this.BagButtons[0].normalSprite = "backpack_icon_misc_off";
this.BagButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[1].normalSprite = "backpack_icon_tmhm_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[2].normalSprite = "backpack_icon_medicine_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[3].normalSprite = "backpack_icon_keyitems_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[4].normalSprite = "backpack_icon_customize_off";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BagButtons[5].normalSprite = "backpack_icon_balls_on";
this.BagButtons[1].SetState(UIButtonColor.State.Normal, true);
break;
}
}
private void SortBags()
{
if (this.BagLabel.text == "TM/HMs")
{
this.SortBag2();
}
else if (this.BagLabel.text == this.Lang.GetString("Potions"))
{
this.SortBag3();
}
else if (this.BagLabel.text == this.Lang.GetString("Key_Items"))
{
this.SortBag4();
}
else if (this.BagLabel.text == this.Lang.GetString("Cloth_Items"))
{
this.SortBag5();
}
else if (this.BagLabel.text == "Balls")
{
this.SortBag6();
}
else
{
this.SortBag();
}
}
public void SortBag()
{
this.ChangeButtonImages(1);
if (this.inBattle)
{
return;
}
this.BagLabel.text = this.Lang.GetString("UItems");
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.DestroyItems();
this.InventoryParent.gameObject.SetActive(false);
List<DSSock.cItem> items = this.Items;
lock (items)
{
if (this.Items.Count > 0)
{
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].Scope != 9 && this.Items[i].Scope != 15 && this.Items[i].Scope != 5 && this.Items[i].Scope != 14 && this.Items[i].Scope != 13 && this.Items[i].Scope != 2 && this.Items[i].Scope != 10 && this.Items[i].Scope != 7 && this.Items[i].ID != 82)
{
InventoryButton inventoryButton = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject2);
inventoryButton.Sock = this;
inventoryButton.transform.parent = this.InventoryParent;
inventoryButton.QTY = this.Items[i].QTY;
inventoryButton.IName = this.Items[i].ItemName;
inventoryButton.ID = this.Items[i].ID;
inventoryButton.name = inventoryButton.IName;
inventoryButton.Scope = this.Items[i].Scope;
inventoryButton.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton.Link = true;
inventoryButton.UpdateIcon();
}
}
}
}
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.InventoryParent.GetComponent<UIGrid>().repositionNow = true;
this.InventoryParent.gameObject.SetActive(true);
}
public void SortBag2()
{
this.ChangeButtonImages(2);
if (this.inBattle)
{
return;
}
this.BagLabel.text = "TM/HMs";
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.DestroyItems();
this.InventoryParent.gameObject.SetActive(false);
List<DSSock.cItem> items = this.Items;
lock (items)
{
if (this.Items.Count > 0)
{
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].Scope == 9 && this.Items[i].ID != 82)
{
InventoryButton inventoryButton = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject2);
inventoryButton.Sock = this;
inventoryButton.transform.parent = this.InventoryParent;
inventoryButton.QTY = this.Items[i].QTY;
inventoryButton.IName = this.Items[i].ItemName;
inventoryButton.ID = this.Items[i].ID;
inventoryButton.name = inventoryButton.IName;
inventoryButton.Scope = this.Items[i].Scope;
inventoryButton.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton.Link = true;
inventoryButton.UpdateIcon();
}
}
}
}
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.InventoryParent.GetComponent<UIGrid>().repositionNow = true;
this.InventoryParent.gameObject.SetActive(true);
}
public void SortBag3()
{
this.ChangeButtonImages(3);
if (this.inBattle)
{
return;
}
this.BagLabel.text = this.Lang.GetString("Potions");
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.DestroyItems();
this.InventoryParent.gameObject.SetActive(false);
List<DSSock.cItem> items = this.Items;
lock (items)
{
if (this.Items.Count > 0)
{
for (int i = 0; i < this.Items.Count; i++)
{
if ((this.Items[i].Scope == 2 || this.Items[i].Scope == 13 || this.Items[i].Scope == 14) && this.Items[i].ID != 82)
{
InventoryButton inventoryButton = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject2);
inventoryButton.Sock = this;
inventoryButton.transform.parent = this.InventoryParent;
inventoryButton.QTY = this.Items[i].QTY;
inventoryButton.IName = this.Items[i].ItemName;
inventoryButton.ID = this.Items[i].ID;
inventoryButton.name = inventoryButton.IName;
inventoryButton.Scope = this.Items[i].Scope;
inventoryButton.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton.Link = true;
inventoryButton.UpdateIcon();
}
}
}
}
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.InventoryParent.GetComponent<UIGrid>().repositionNow = true;
this.InventoryParent.gameObject.SetActive(true);
}
public void SortBag4()
{
this.ChangeButtonImages(4);
if (this.inBattle)
{
return;
}
this.BagLabel.text = this.Lang.GetString("Key_Items");
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.DestroyItems();
this.InventoryParent.gameObject.SetActive(false);
List<DSSock.cItem> items = this.Items;
lock (items)
{
if (this.Items.Count > 0)
{
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].Scope == 10 && this.Items[i].ID != 82)
{
InventoryButton inventoryButton = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject2);
inventoryButton.Sock = this;
inventoryButton.transform.parent = this.InventoryParent;
inventoryButton.QTY = this.Items[i].QTY;
inventoryButton.IName = this.Items[i].ItemName;
inventoryButton.ID = this.Items[i].ID;
inventoryButton.name = inventoryButton.IName;
inventoryButton.Scope = this.Items[i].Scope;
inventoryButton.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton.Link = true;
inventoryButton.UpdateIcon();
}
}
}
}
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.InventoryParent.GetComponent<UIGrid>().repositionNow = true;
this.InventoryParent.gameObject.SetActive(true);
}
public void SortBag5()
{
this.ChangeButtonImages(5);
if (this.inBattle)
{
return;
}
this.BagLabel.text = this.Lang.GetString("Cloth_Items");
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.DestroyItems();
this.InventoryParent.gameObject.SetActive(false);
List<DSSock.cItem> items = this.Items;
lock (items)
{
if (this.Items.Count > 0)
{
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].Scope == 15)
{
InventoryButton inventoryButton = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject2);
inventoryButton.Sock = this;
inventoryButton.transform.parent = this.InventoryParent;
inventoryButton.QTY = this.Items[i].QTY;
inventoryButton.IName = this.Items[i].ItemName;
inventoryButton.ID = this.Items[i].ID;
inventoryButton.name = inventoryButton.IName;
inventoryButton.Scope = this.Items[i].Scope;
inventoryButton.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton.Link = true;
inventoryButton.UpdateIcon();
}
}
}
}
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.InventoryParent.GetComponent<UIGrid>().repositionNow = true;
this.InventoryParent.gameObject.SetActive(true);
}
public void SortBag6()
{
this.ChangeButtonImages(6);
if (this.inBattle)
{
return;
}
this.BagLabel.text = "Balls";
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.DestroyItems();
this.InventoryParent.gameObject.SetActive(false);
List<DSSock.cItem> items = this.Items;
lock (items)
{
if (this.Items.Count > 0)
{
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].Scope == 5)
{
InventoryButton inventoryButton = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject2);
inventoryButton.Sock = this;
inventoryButton.transform.parent = this.InventoryParent;
inventoryButton.QTY = this.Items[i].QTY;
inventoryButton.IName = this.Items[i].ItemName;
inventoryButton.ID = this.Items[i].ID;
inventoryButton.name = inventoryButton.IName;
inventoryButton.Scope = this.Items[i].Scope;
inventoryButton.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton.Link = true;
inventoryButton.UpdateIcon();
}
}
}
}
this.InventoryParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.InventoryParent.GetComponent<UIGrid>().repositionNow = true;
this.InventoryParent.gameObject.SetActive(true);
}
public void DestroyItems()
{
GameObject[] array = GameObject.FindGameObjectsWithTag("InventoryItem");
GameObject[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
GameObject obj = array2[i];
UnityEngine.Object.Destroy(obj);
}
}
public void ReorderPoke(int Poke1, int Poke2)
{
if (this.ScriptPause)
{
return;
}
if (this.Pokemons.Count <= 1)
{
return;
}
if (this.inBattle)
{
return;
}
if (this.inTrade)
{
return;
}
if (Poke2 > this.Pokemons.Count)
{
return;
}
if (Poke1 > this.Pokemons.Count)
{
return;
}
if (this.Evolving)
{
return;
}
if (Poke1 == Poke2)
{
return;
}
if (this.MoveGUIs.activeSelf)
{
return;
}
if (this.MR.LearnWindow.activeSelf)
{
return;
}
if (this.ER.LearnWindow.activeSelf)
{
return;
}
this.sendPacket("?|.|" + Poke1.ToString() + "|.|" + Poke2.ToString());
this.Info.gameObject.SetActive(false);
}
public void ReorderPoke3(int Poke1)
{
if (this.Evolving)
{
return;
}
if (this.ScriptPause)
{
return;
}
if (this.MoveGUIs.activeSelf)
{
return;
}
if (this.MR.LearnWindow.activeSelf)
{
return;
}
if (this.ER.LearnWindow.activeSelf)
{
return;
}
if (this.Pokemons.Count <= 1)
{
return;
}
if (this.inBattle)
{
return;
}
if (this.inTrade)
{
return;
}
if (Poke1 > this.Pokemons.Count)
{
return;
}
this.sendPacket("?|.|" + Poke1.ToString() + "|.|-1");
this.Info.gameObject.SetActive(false);
}
public void ReorderPoke2(int Poke1, int Poke2)
{
if (this.Evolving)
{
return;
}
if (this.ScriptPause)
{
return;
}
if (this.MoveGUIs.activeSelf)
{
return;
}
if (this.MR.LearnWindow.activeSelf)
{
return;
}
if (this.ER.LearnWindow.activeSelf)
{
return;
}
if (this.inBattle)
{
return;
}
if (this.inTrade)
{
return;
}
if (Poke1 == Poke2)
{
return;
}
if (Poke2 < 7 && Poke2 >= this.Pokemons.Count + 1)
{
Poke2 = this.Pokemons.Count + 1;
}
this.sendPacket("?|.|" + Poke1.ToString() + "|.|" + Poke2.ToString());
this.Info.gameObject.SetActive(false);
}
private void openTrainer()
{
if (this.trainerGUI.activeSelf)
{
this.trainerGUI.SetActive(false);
}
else
{
this.trainerGUI.SetActive(true);
}
}
private void openFriends()
{
if (this.friendsGUI.activeSelf)
{
this.friendsGUI.SetActive(false);
}
else
{
this.friendsGUI.SetActive(true);
this.showFriends();
}
}
private void sortRoster(string rosterlist)
{
this.RosterList.Clear();
if (rosterlist.Length < 3)
{
return;
}
string[] array = rosterlist.Split(new string[]
{
"|"
}, StringSplitOptions.None);
for (int i = 0; i < array.Length; i++)
{
if (array[i].Length > 1)
{
if (array[i].IndexOf(":0") != -1)
{
array[i] = array[i].Replace(":0", string.Empty);
this.RosterList.Add(" [40FF00][ON] " + array[i] + " [-] ");
}
else if (array[i].IndexOf(":2") != -1)
{
array[i] = array[i].Replace(":2", string.Empty);
this.RosterList.Add(" [FFD500][AW] " + array[i] + " [-] ");
}
else
{
array[i] = array[i].Replace(":1", string.Empty);
this.RosterList.Add(" [OF] " + array[i] + " ");
}
}
}
}
private void sortFriends(string friendsList)
{
this.FriendsList.Clear();
if (friendsList.Length < 3)
{
return;
}
string[] array = friendsList.Split(new string[]
{
"|"
}, StringSplitOptions.None);
for (int i = 0; i < array.Length; i++)
{
if (array[i].Length > 1)
{
if (array[i].IndexOf(":0") != -1)
{
array[i] = array[i].Replace(":0", string.Empty);
this.FriendsList.Add(" [40FF00][ON] " + array[i] + " [-] ");
}
else if (array[i].IndexOf(":2") != -1)
{
array[i] = array[i].Replace(":2", string.Empty);
this.FriendsList.Add(" [FFD500][AW] " + array[i] + " [-] ");
}
else
{
array[i] = array[i].Replace(":1", string.Empty);
this.FriendsList.Add(" [OF] " + array[i] + " ");
}
}
}
}
public void showFriends()
{
this.FriendsScroll.SetActive(true);
this.FriendsList.gameObject.SetActive(true);
this.sendPacket("f");
}
public void AddChat(string Text, string Channel = "")
{
DSSock.SavedChats savedChats = new DSSock.SavedChats();
savedChats.Text = Text;
savedChats.Channel = Channel;
List<DSSock.SavedChats> savedChat = this.SavedChat;
lock (savedChat)
{
this.SavedChat.Add(savedChats);
if (this.SavedChat.Count > 90)
{
this.SavedChat.RemoveAt(0);
}
}
if (Channel == "System")
{
this.ChatText.Add(Text);
}
else if ((this.CI.ChatID > 0 && Channel == this.CI.ChatString) || this.CI.ChatID == 0)
{
this.ChatText.Add(Text);
}
}
public void ResortChat()
{
this.ChatText.Clear();
int num = 0;
List<DSSock.SavedChats> savedChat = this.SavedChat;
lock (savedChat)
{
for (int i = 0; i < this.SavedChat.Count; i++)
{
if (this.SavedChat[i].Channel == "System" || this.CI.ChatID == 0 || (this.SavedChat[i].Channel == this.CI.ChatString && this.CI.ChatID > 0))
{
this.ChatText.Add(this.SavedChat[i].Text);
num++;
}
}
}
}
public void createChannel()
{
this.ChannelHandler.init("Join/Create Channel");
this.HideChatManager();
}
public void UpdateTabs()
{
List<GameObject> channelButtons = this.ChannelButtons;
lock (channelButtons)
{
for (int i = 0; i < this.ChannelButtons.Count; i++)
{
if (this.ChannelButtons[i] != null)
{
UnityEngine.Object.Destroy(this.ChannelButtons[i].gameObject);
}
}
}
this.ChannelButtons = new List<GameObject>();
int num = 0;
for (int j = 0; j < this.SavedChan.Count; j++)
{
if (num < 5 && PlayerPrefs.GetInt("Show" + this.SavedChan[j].Name, 1) == 1)
{
GameObject gameObject = UnityEngine.Object.Instantiate(this.ChatPrefab, this.TabParent.position, Quaternion.identity) as GameObject;
gameObject.GetComponent<changeLabel>().ChangeLabel(this.SavedChan[j].Name);
gameObject.name = this.SavedChan[j].Name;
gameObject.GetComponent<changeLabel>().ChatID = this.SavedChan[j].ID;
gameObject.transform.parent = this.TabParent;
gameObject.transform.localPosition += new Vector3((float)(-(float)((num + 1) * 67) - 33), 0f, 0f);
gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
gameObject.GetComponent<changeLabel>().Colour = PlayerPrefs.GetInt("Chat" + this.SavedChan[j].Name, 1);
List<GameObject> channelButtons2 = this.ChannelButtons;
lock (channelButtons2)
{
this.ChannelButtons.Add(gameObject);
}
num++;
}
}
}
private void makeChannels(string ch)
{
if (ch.IndexOf("=-") != -1)
{
return;
}
string[] array = ch.Split(new string[]
{
"|"
}, StringSplitOptions.None);
int num = (int)Convert.ToInt16(array[0]);
if (num < this.ChannelButtons.Count - 2)
{
return;
}
List<GameObject> channelButtons = this.ChannelButtons;
lock (channelButtons)
{
for (int i = 0; i < this.ChannelButtons.Count; i++)
{
if (this.ChannelButtons[i] != null)
{
UnityEngine.Object.Destroy(this.ChannelButtons[i].gameObject);
}
}
}
GameObject[] array2 = GameObject.FindGameObjectsWithTag("Channel");
GameObject[] array3 = array2;
for (int j = 0; j < array3.Length; j++)
{
GameObject obj = array3[j];
UnityEngine.Object.Destroy(obj);
}
this.ChannelButtons = new List<GameObject>();
this.SavedChan = new List<DSSock.SavedChannels>();
for (int k = 1; k <= num; k++)
{
GameObject gameObject = UnityEngine.Object.Instantiate(this.ChannelPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject;
gameObject.transform.parent = this.ChannelManagerObject.transform;
gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
gameObject.GetComponent<Channel>().ChannelLabel.text = array[k * 2];
if (PlayerPrefs.GetInt("Show" + array[k * 2], 1) == 1)
{
gameObject.GetComponent<Channel>().Toggle.value = true;
}
else
{
gameObject.GetComponent<Channel>().Toggle.value = false;
}
DSSock.SavedChannels savedChannels = new DSSock.SavedChannels();
savedChannels.ID = array[k * 2 - 1];
savedChannels.Name = array[k * 2];
List<DSSock.SavedChannels> savedChan = this.SavedChan;
lock (savedChan)
{
this.SavedChan.Add(savedChannels);
}
}
int num2 = 0;
for (int l = 1; l <= num; l++)
{
if (num2 < 5 && PlayerPrefs.GetInt("Show" + array[l * 2], 1) == 1)
{
GameObject gameObject2 = UnityEngine.Object.Instantiate(this.ChatPrefab, this.TabParent.position, Quaternion.identity) as GameObject;
gameObject2.GetComponent<changeLabel>().ChangeLabel(array[l * 2]);
gameObject2.name = array[l * 2];
gameObject2.GetComponent<changeLabel>().ChatID = array[l * 2 - 1];
gameObject2.transform.parent = this.TabParent;
gameObject2.transform.localPosition += new Vector3((float)(-(float)((num2 + 1) * 67) - 33), 0f, 0f);
gameObject2.transform.localScale = new Vector3(1f, 1f, 1f);
gameObject2.GetComponent<changeLabel>().Colour = PlayerPrefs.GetInt("Chat" + array[l * 2], 1);
List<GameObject> channelButtons2 = this.ChannelButtons;
lock (channelButtons2)
{
this.ChannelButtons.Add(gameObject2);
}
num2++;
}
}
this.ChannelManagerObject.GetComponent<UIGrid>().Reposition();
this.ChannelManagerObject.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.ChannelManagerObject.GetComponent<UIGrid>().repositionNow = true;
}
public void HideChatManager()
{
this.UpdateTabs();
this.ChannelManagerPanel.GetComponent<UIPanel>().alpha = 0f;
}
public void ShowChatManager()
{
GameObject[] array = GameObject.FindGameObjectsWithTag("Channel");
GameObject[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
GameObject gameObject = array2[i];
if (PlayerPrefs.GetInt("Show" + gameObject.GetComponent<Channel>().ChannelLabel.text, 1) == 1)
{
gameObject.GetComponent<Channel>().Toggle.value = true;
}
else
{
gameObject.GetComponent<Channel>().Toggle.value = false;
}
}
this.ChannelManagerPanel.GetComponent<UIPanel>().alpha = 1f;
}
private void DestroyNPCs(string data)
{
if (data.Length <= 4)
{
return;
}
string[] array = data.Split(new string[]
{
"|"
}, StringSplitOptions.None);
for (int i = 2; i < array.Length; i++)
{
for (int j = 0; j < this.NPCS.Count; j++)
{
if (this.NPCS[j] != null && this.NPCS[j].GetComponent<cNPC>().ID == Convert.ToInt32(array[i]))
{
UnityEngine.Object.Destroy(this.NPCS[j]);
break;
}
}
}
}
private void NoBattlers(string data)
{
if (data.Length <= 4)
{
return;
}
string[] array = data.Split(new string[]
{
"|"
}, StringSplitOptions.None);
for (int i = 2; i < array.Length; i++)
{
for (int j = 0; j < this.NPCS.Count; j++)
{
if (this.NPCS[j] != null && this.NPCS[j].GetComponent<cNPC>().ID == Convert.ToInt32(array[i]))
{
this.NPCS[j].GetComponent<cNPC>().LOSExpired = true;
this.NPCS[j].GetComponent<cNPC>().isBattle = false;
break;
}
}
}
}
public void ShowBattle(string startString)
{
this.isPVPBattle = false;
this.BTimer.alpha = 0f;
this.lastPVPMove = Time.time;
this.SelectedMove = false;
this.RankedHandle.ClosePanel();
this.PCBox.SetActive(false);
this.BattleButtons[3].enabled = true;
this.BattleButtons[3].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[1].enabled = true;
this.BattleButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[0].enabled = true;
this.BattleButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[2].enabled = true;
this.BattleButtons[2].SetState(UIButtonColor.State.Normal, true);
this.HandleShop.CloseShop();
this.resumeMusic = false;
this.WeatherSprite.spriteName = string.Empty;
this.processingBattle = false;
this.doHealth = false;
this.bagGUI.SetActive(false);
this.UseOn.SetActive(false);
this.FlashFoe = false;
this.FlashUser = false;
if (this.mapCreator.MapWeather == "Snow")
{
if (this.OutSideLight >= 20 || this.OutSideLight <= 6)
{
this.BattleBack.mainTexture = this.Backgrounds[19];
}
else if (this.OutSideLight >= 15 && this.OutSideLight <= 19)
{
this.BattleBack.mainTexture = this.Backgrounds[18];
}
else
{
this.BattleBack.mainTexture = this.Backgrounds[17];
}
}
else if (this.mapCreator.mapName.ToLower().IndexOf("pokecenter") != -1)
{
if (this.OutSideLight >= 20 || this.OutSideLight <= 6)
{
this.BattleBack.mainTexture = this.Backgrounds[2];
}
else if (this.OutSideLight >= 15 && this.OutSideLight <= 19)
{
this.BattleBack.mainTexture = this.Backgrounds[1];
}
else
{
this.BattleBack.mainTexture = this.Backgrounds[0];
}
}
else if (this.mapCreator.mapName.ToLower().IndexOf("seafoam") != -1 || this.mapCreator.mapName.ToLower().IndexOf("ice path") != -1 || this.mapCreator.mapName.ToLower().IndexOf("icefall") != -1)
{
this.BattleBack.mainTexture = this.Backgrounds[11];
if (this.mapCreator.Colliders[(int)this.newPos.x, -(int)this.newPos.y] == 5)
{
this.BattleBack.mainTexture = this.Backgrounds[12];
}
}
else if (this.mapCreator.mapName.ToLower().IndexOf("forest") != -1 && this.mapCreator.Colliders[(int)this.newPos.x, -(int)this.newPos.y] != 5)
{
this.BattleBack.mainTexture = this.Backgrounds[6];
if (this.OutSideLight >= 15 && this.OutSideLight <= 19)
{
this.BattleBack.mainTexture = this.Backgrounds[7];
}
else if (this.OutSideLight >= 20 || this.OutSideLight <= 6)
{
this.BattleBack.mainTexture = this.Backgrounds[8];
}
}
else if (this.mapCreator.mapName.ToLower().IndexOf("love island") != -1 && this.mapCreator.Colliders[(int)this.newPos.x, -(int)this.newPos.y] != 5)
{
this.BattleBack.mainTexture = this.Backgrounds[14];
if (this.OutSideLight >= 15 && this.OutSideLight <= 19)
{
this.BattleBack.mainTexture = this.Backgrounds[15];
}
else if (this.OutSideLight >= 20 || this.OutSideLight <= 6)
{
this.BattleBack.mainTexture = this.Backgrounds[16];
}
}
else if (this.mapCreator.mapName.ToLower().IndexOf("dragons den") != -1 || this.mapCreator.mapName.ToLower().IndexOf("rock tunnel") != -1 || this.mapCreator.mapName.ToLower().IndexOf("pewter gym") != -1 || this.mapCreator.mapName.ToLower().IndexOf("tohjo falls") != -1 || this.mapCreator.mapName.ToLower().IndexOf("mt. moon") != -1 || this.mapCreator.mapName.ToLower().IndexOf("cave") != -1 || this.mapCreator.mapName.ToLower().IndexOf("Victory Road Kanto") != -1 || this.mapCreator.mapName.ToLower().IndexOf("mt. silver 1f") != -1 || this.mapCreator.mapName.ToLower().IndexOf("mt. silver 2f") != -1 || this.mapCreator.mapName.ToLower().IndexOf("mt. silver 3f") != -1 || this.mapCreator.mapName.ToLower().IndexOf("mt. mortar b1f") != -1 || this.mapCreator.mapName.ToLower().IndexOf("mt. mortar b1f") != -1 || this.mapCreator.mapName.ToLower().IndexOf("mt. mortar 1f") != -1 || this.mapCreator.mapName.ToLower().IndexOf("whirl islands") != -1)
{
this.BattleBack.mainTexture = this.Backgrounds[9];
if (this.mapCreator.Colliders[(int)this.newPos.x, -(int)this.newPos.y] == 5)
{
this.BattleBack.mainTexture = this.Backgrounds[10];
}
}
else if (this.mapCreator.mapName.ToLower().IndexOf("cerulean gym") != -1 || this.mapCreator.Colliders[(int)this.newPos.x, -(int)this.newPos.y] == 5)
{
this.BattleBack.mainTexture = this.Backgrounds[3];
if (this.OutSideLight >= 15 && this.OutSideLight <= 19)
{
this.BattleBack.mainTexture = this.Backgrounds[4];
}
else if (this.OutSideLight >= 20 || this.OutSideLight <= 6)
{
this.BattleBack.mainTexture = this.Backgrounds[5];
}
}
else if (!this.mapCreator.outside && this.mapCreator.mapName.ToLower().IndexOf("faraway island") == -1)
{
this.BattleBack.mainTexture = this.Backgrounds[13];
}
else if (this.OutSideLight >= 20 || this.OutSideLight <= 6)
{
this.BattleBack.mainTexture = this.Backgrounds[2];
}
else if (this.OutSideLight >= 15 && this.OutSideLight <= 19)
{
this.BattleBack.mainTexture = this.Backgrounds[1];
}
else
{
this.BattleBack.mainTexture = this.Backgrounds[0];
}
if (this.mapCreator.mapName.ToLower().IndexOf("cinnabar gym") != -1)
{
this.BattleBack.mainTexture = this.Backgrounds[9];
}
if (this.Items.Count > 0)
{
for (int i = 0; i < this.Items.Count; i++)
{
if ((this.Items[i].Scope == 2 || this.Items[i].Scope == 5) && this.Items[i].QTY > 0)
{
InventoryButton inventoryButton = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject);
inventoryButton.Sock = this;
inventoryButton.transform.parent = this.BattleItemParent;
inventoryButton.QTY = this.Items[i].QTY;
inventoryButton.IName = this.Items[i].ItemName;
inventoryButton.ID = this.Items[i].ID;
inventoryButton.name = inventoryButton.IName;
inventoryButton.Scope = this.Items[i].Scope;
inventoryButton.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton.UpdateIcon();
}
}
}
this.BattleItemParent.GetComponent<UIGrid>().Reposition();
this.BattleItemParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.BattleItemParent.GetComponent<UIGrid>().repositionNow = true;
this.inBattle = true;
this.deadPokes = 0;
this.FaintFoe = false;
this.CatchPoke = 0;
this.CatchBall.transform.localPosition = new Vector3(270f, 280f, 0f);
this.CatchBall.color = new Color(0f, 0f, 0f, 0f);
this.FoePoke.transform.localScale = new Vector3(1f, 1f, 1f);
this.FoePoke.GetComponent<UITexture>().color = new Color(1f, 1f, 1f, 1f);
this.CatchPoke = 0;
this.CatchPokemon = false;
this.FaintUser = false;
this.SetStatus(0, string.Empty);
this.SetStatus(1, string.Empty);
this.BLock = false;
this.BattleType = 0;
this.BattleScroll = false;
this.BattleFoe.text = string.Empty;
this.BattleSay = string.Empty;
this.BattleLog.text = string.Empty;
this.AttackObject.SetActive(false);
this.PokemonObject.SetActive(false);
this.BattleName.text = this.Players.pname;
startString = startString.Substring(4);
string[] array = startString.Split(new string[]
{
"|"
}, StringSplitOptions.None);
this.OtherGender = array[9];
this.OtherPoke = Convert.ToInt32(array[0]);
this.SelPoke = Convert.ToInt32(array[3]) - 1;
this.BattlePokeNames[2].text = "[" + this.OtherGender + "]Lv. " + array[2];
this.BattlePokeNames[3].text = "[" + this.Pokemons[this.SelPoke].Gender + "]Lv. " + this.Pokemons[this.SelPoke].lvl.ToString();
this.BattleEXP.width = this.Pokemons[this.SelPoke].exptodraw * 2 + 9;
int width = (int)(151.0 / ((double)this.Pokemons[this.SelPoke].hp / (double)this.Pokemons[this.SelPoke].hpleft * 100.0) * 100.0 - 1.0);
this.BattleHP[0].width = width;
this.OtherHP = Convert.ToInt32(array[1]);
this.OtherHPLeft = Convert.ToInt32(array[1]);
width = (int)(151.0 / ((double)this.OtherHP / (double)this.OtherHPLeft * 100.0) * 100.0 - 1.0);
this.BattleHP[1].width = width;
this.BattleSay = array[4];
this.BScrollCount = 0f;
this.BScrollTo = 0;
this.BattleScroll = true;
if (array[5] == "0")
{
this.OtherShiny = string.Empty;
this.BattlePokeNames[0].text = this.MonsterName[this.OtherPoke];
}
else
{
this.OtherShiny = "S";
this.BattlePokeNames[0].text = "[S]" + this.MonsterName[this.OtherPoke];
}
if (this.Pokemons[this.SelPoke].shiny != 0)
{
this.BattlePokeNames[1].text = "[S]" + this.MonsterName[this.Pokemons[this.SelPoke].ID];
}
else
{
this.BattlePokeNames[1].text = this.MonsterName[this.Pokemons[this.SelPoke].ID];
}
for (int j = 0; j < 14; j++)
{
this.Hazards[j].SetActive(false);
}
if (array[8] == string.Empty)
{
this.TotalPokes = 1;
}
else
{
this.TotalPokes = Convert.ToInt32(array[8]);
}
for (int k = 0; k < 12; k++)
{
this.PokeBalls[k].GetComponent<UISprite>().spriteName = "Battle_ball";
this.PokeBalls[k].SetActive(false);
}
for (int l = 0; l < this.Pokemons.Count; l++)
{
this.PokeBalls[l].SetActive(true);
if (this.Pokemons[l].hpleft <= 0)
{
this.PokeBalls[l].GetComponent<UISprite>().spriteName = "Battle_ball2";
}
}
for (int m = 0; m < this.TotalPokes; m++)
{
this.PokeBalls[m + 6].SetActive(true);
}
if (array[6] == string.Empty && array[8] == string.Empty)
{
this.ShowLevel = true;
this.BattleFoe.text = "Wild " + this.MonsterName[Convert.ToInt32(array[0])];
this.BattleType = 0;
this.PlayMusic(6);
this.CanMove = true;
this.ScriptPause = false;
this.NPCTObject.SetActive(false);
this.NPCText.text = string.Empty;
this.doMessages = 0;
this.MessageStuck = false;
this.Scripts = new List<DSSock.ScriptClass>();
this.QuedScripts = new List<DSSock.ScriptClass>();
}
else if (array[7] == string.Empty)
{
this.isPVPBattle = true;
this.PlayMusic(67);
this.BattleFoe.text = array[6];
this.BattleType = 2;
}
else
{
this.PlayMusic(7);
this.BattleFoe.text = array[6];
if (this.BattleFoe.text == string.Empty)
{
this.BattleFoe.text = "Trainer";
}
this.BattleType = 1;
if (!this.ShowLevel)
{
this.BattlePokeNames[2].text = "[" + this.OtherGender + "]Lv. ??";
}
}
this.UserStats[0].alpha = 0f;
this.UserStats[1].alpha = 0f;
this.SetStatus(1, array[10]);
this.SetStatus(0, this.Pokemons[this.SelPoke].Status);
this.BattlePanel.alpha = 0f;
this.BattleScreen.SetActive(true);
this.BattleBlanker.gameObject.SetActive(true);
this.showFoe = true;
this.FoePoke.transform.localPosition = new Vector3(500f, this.FoePoke.transform.localPosition.y, this.FoePoke.transform.localPosition.z);
this.ThrowBall();
int num = this.BattleSay.IndexOf("\r\n", 0);
string text = this.BattleSay.Substring(0, num) + "\r\n";
string text2 = this.BattleSay.Substring(num + 2);
if (text2.Length > 3)
{
if (text2.Substring(text2.Length - 2, 2) == "\r\n")
{
text2 = text2.Substring(0, text2.Length - 2);
}
}
else
{
text2 = string.Empty;
}
this.BattleSay = string.Concat(new string[]
{
text,
"Go [FF9900]",
this.MonsterName[this.Pokemons[this.SelPoke].ID],
"[-]!\r\n",
text2
});
if (this.BattleSay.Substring(this.BattleSay.Length - 2, 2) == "\r\n")
{
this.BattleSay = this.BattleSay.Substring(0, this.BattleSay.Length - 2);
}
if (this.BattleSay.ToLower().IndexOf("started to rain") != -1)
{
this.WeatherSprite.spriteName = "weatherrain";
}
else if (this.BattleSay.ToLower().IndexOf("rain continues to fall") != -1)
{
this.WeatherSprite.spriteName = "weatherrain";
}
else if (this.BattleSay.ToLower().IndexOf("rain stopped") != -1)
{
this.WeatherSprite.spriteName = string.Empty;
}
else if (this.BattleSay.ToLower().IndexOf("sunlight got bright") != -1)
{
this.WeatherSprite.spriteName = "weathersun";
}
else if (this.BattleSay.ToLower().IndexOf("sunlight faded") != -1)
{
this.WeatherSprite.spriteName = string.Empty;
}
else if (this.BattleSay.ToLower().IndexOf("buffeted by the sandstorm") != -1)
{
this.WeatherSprite.spriteName = "weathersand";
}
else if (this.BattleSay.ToLower().IndexOf("sandstorm kicked") != -1)
{
this.WeatherSprite.spriteName = "weathersand";
}
else if (this.BattleSay.ToLower().IndexOf("sandstorm subsided") != -1)
{
this.WeatherSprite.spriteName = string.Empty;
}
else if (this.BattleSay.ToLower().IndexOf("started to hail") != -1)
{
this.WeatherSprite.spriteName = "weatherhail";
}
else if (this.BattleSay.ToLower().IndexOf("hail stopped") != -1)
{
this.WeatherSprite.spriteName = string.Empty;
}
this.OtherForm = string.Empty;
if (array[12] != "0")
{
this.OtherForm = "_" + array[12];
}
this.FoePoke.GetComponent<UITexture>().mainTexture = Resources.Load<Texture2D>(this.OtherShiny + "Big/" + this.OtherPoke.ToString() + this.OtherForm);
UILabel expr_1487 = this.BattleName;
expr_1487.text = expr_1487.text + " [VS] " + this.BattleFoe.text;
this.BLog.alpha = 0f;
this.HPTO = this.Pokemons[this.SelPoke].hpleft;
this.OTHERHPTO = this.OtherHPLeft;
this.CaughtBall.SetActive(false);
if (array[11] == "1")
{
this.CaughtBall.SetActive(true);
}
else if (!this.Pokedex.HasSeen(this.OtherPoke))
{
this.sendPacket("k|.|" + this.mapCreator.mapName.ToLower());
}
}
private void ThrowBall()
{
this.throwSound = true;
this.throwBall = true;
this.throwDown = false;
this.ThrowObject[0].transform.localPosition = new Vector3(-200f, this.ThrowObject[0].transform.localPosition.y, this.ThrowObject[0].transform.localPosition.z);
this.ThrowObject[1].transform.localPosition = new Vector3(-98f, this.ThrowObject[1].transform.localPosition.y, this.ThrowObject[1].transform.localPosition.z);
this.ThrowObject[2].transform.localPosition = new Vector3(-68f, -10f, this.ThrowObject[2].transform.localPosition.z);
this.ThrowObject[0].SetActive(true);
this.ThrowObject[1].SetActive(false);
this.ThrowObject[2].SetActive(false);
this.UserPoke.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
this.UserPoke.transform.localPosition = new Vector3(-34f, -67f, 0f);
string str = string.Empty;
if (this.Pokemons[this.SelPoke].Form > 0)
{
str = "_" + this.Pokemons[this.SelPoke].Form.ToString();
}
if (this.Pokemons[this.SelPoke].shiny != 0)
{
this.UserPoke.GetComponent<UITexture>().mainTexture = Resources.Load<Texture2D>("SBack/" + this.Pokemons[this.SelPoke].ID.ToString() + str);
}
else
{
this.UserPoke.GetComponent<UITexture>().mainTexture = Resources.Load<Texture2D>("Back/" + this.Pokemons[this.SelPoke].ID.ToString() + str);
}
}
private void BattleLoop()
{
if (this.BLock)
{
if (!this.LockText.activeSelf)
{
this.LockText.SetActive(true);
}
if (!this.BattleItemObject.activeSelf)
{
this.BattleItemObject.SetActive(false);
}
}
else if (this.LockText.activeSelf)
{
this.LockText.SetActive(false);
}
this.scrollhealth = false;
if (this.doHealth)
{
int num = (int)(151.0 / ((double)this.OtherHP / (double)this.OtherHPLeft * 100.0) * 100.0 - 1.0);
if (num > 151)
{
num = 151;
}
if (num <= 2)
{
num = 2;
}
if (this.BattleHP[1].width != num)
{
if (this.BattleHP[1].width <= num)
{
this.scrollCounter += 100f * Time.deltaTime;
if (this.scrollCounter > 1f)
{
this.BattleHP[1].width += 3;
this.scrollCounter = 0f;
}
}
else
{
this.scrollCounter += 100f * Time.deltaTime;
if (this.scrollCounter > 1f)
{
this.BattleHP[1].width -= 3;
this.scrollCounter = 0f;
}
}
if (this.BattleHP[1].width <= num + 4 && this.BattleHP[1].width >= num - 4)
{
this.BattleHP[1].width = num;
}
this.scrollhealth = true;
}
num = (int)(151.0 / ((double)this.Pokemons[this.SelPoke].hp / (double)this.Pokemons[this.SelPoke].hpleft * 100.0) * 100.0 - 1.0);
if (num > 151)
{
num = 151;
}
if (num <= 2)
{
num = 2;
}
if (this.BattleHP[0].width != num)
{
if (this.BattleHP[0].width < num)
{
this.scrollCounter += 100f * Time.deltaTime;
if (this.scrollCounter > 1f)
{
this.BattleHP[0].width += 3;
this.scrollCounter = 0f;
}
}
else
{
this.scrollCounter += 100f * Time.deltaTime;
if (this.scrollCounter > 1f)
{
this.BattleHP[0].width -= 3;
this.scrollCounter = 0f;
}
}
if (this.BattleHP[0].width <= num + 4 && this.BattleHP[0].width >= num - 4)
{
this.BattleHP[0].width = num;
}
this.scrollhealth = true;
}
if (this.scrollhealth)
{
return;
}
this.doHealth = false;
}
if (this.BattleIdle)
{
this.BAT += 2f * Time.deltaTime;
if (this.BAT < 1f)
{
this.UserPoke.transform.localPosition = new Vector3(-34f, -67f, 0f);
}
if (this.BAT > 1f)
{
this.UserPoke.transform.localPosition = new Vector3(-34f, -72f, 0f);
}
if (this.BAT > 2f)
{
this.BAT = 0f;
}
if (!this.BattleButtons[2].enabled && !this.BattleButtons[3].enabled)
{
for (int i = 0; i < 4; i++)
{
this.BattleButtons[i].enabled = true;
this.BattleButtons[i].SetState(UIButtonColor.State.Normal, true);
}
}
if (!this.AttackButtons[3].enabled)
{
for (int j = 0; j < 4; j++)
{
this.AttackButtons[j].enabled = true;
this.AttackButtons[j].SetState(UIButtonColor.State.Normal, true);
}
}
}
else
{
this.UserPoke.transform.localPosition = new Vector3(-34f, -67f, 0f);
if (this.BattleButtons[2].enabled && this.BattleButtons[3].enabled)
{
for (int k = 0; k < 4; k++)
{
this.BattleButtons[k].enabled = false;
this.BattleButtons[k].SetState(UIButtonColor.State.Disabled, true);
}
}
if (this.AttackButtons[3].enabled)
{
for (int l = 0; l < 4; l++)
{
this.AttackButtons[l].enabled = false;
this.AttackButtons[l].SetState(UIButtonColor.State.Disabled, true);
}
}
}
this.BattleIdle = false;
this.BattleBlanker.alpha = this.BattlePanel.alpha;
if (this.BattlePanel.alpha < 1f)
{
this.BattlePanel.alpha += 2f * Time.deltaTime;
return;
}
this.BattlePanel.alpha = 1f;
if (this.UserStats[0].alpha < 1f)
{
this.UserStats[0].alpha += 2f * Time.deltaTime;
this.UserStats[1].alpha += 2f * Time.deltaTime;
return;
}
this.UserStats[0].alpha = 1f;
this.UserStats[1].alpha = 1f;
if (this.CatchPoke == 1)
{
this.CatchBall.color = new Color(1f, 1f, 1f, this.CatchBall.color.a + 10f * Time.deltaTime);
if (this.CatchBall.transform.localPosition.y > 148f)
{
this.FoePoke.transform.localScale -= new Vector3(3f, 3f, 3f) * Time.deltaTime;
if (this.FoePoke.transform.localScale.x <= 0f)
{
this.FoePoke.transform.localScale = new Vector3(0f, 0f, 0f);
}
this.FoePoke.GetComponent<UITexture>().color = new Color(this.FoePoke.transform.localScale.x, this.FoePoke.transform.localScale.x, this.FoePoke.transform.localScale.x, 1f);
this.CatchBall.transform.localPosition -= new Vector3(0f, 300f, 0f) * Time.deltaTime;
}
else
{
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[41], Camera.main.transform.position, this.SFXVolume);
this.CatchBall.transform.localPosition = new Vector3(this.CatchBall.transform.localPosition.x, 148f, this.FoePoke.transform.localPosition.z);
this.CatchPoke = 6;
this.CatchBall.width = 30;
this.CatchBall.height = 30;
this.CatchBall.spriteName = "Balls";
this.CatchBall.color = new Color(1f, 1f, 1f, 1f);
this.lastCaught = Time.time;
}
return;
}
if (this.CatchPoke == 2)
{
this.FoePoke.GetComponent<UITexture>().color = new Color(0f, 0f, 0f, 0f);
this.CatchBall.transform.Rotate(0f, 0f, 80f * Time.deltaTime);
if (this.CatchBall.transform.localRotation.eulerAngles.z > 20f)
{
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[42], Camera.main.transform.position, this.SFXVolume);
this.CatchPoke = 3;
}
return;
}
if (this.CatchPoke == 3)
{
this.CatchBall.transform.Rotate(0f, 0f, -80f * Time.deltaTime);
if (this.CatchBall.transform.localRotation.eulerAngles.z <= 1f || this.CatchBall.transform.localRotation.eulerAngles.z >= 100f)
{
this.CatchBall.transform.localRotation = new Quaternion(0f, 0f, 0f, 0f);
if (this.CatchShakes > 0)
{
this.CatchShakes--;
this.lastCaught = Time.time;
this.CatchPoke = 7;
return;
}
if (this.CatchPokemon)
{
this.CatchPoke = 5;
}
else
{
this.CatchPoke = 4;
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[43], Camera.main.transform.position, this.SFXVolume);
GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.OutOfBall);
gameObject.transform.parent = this.FoePoke.transform.parent;
gameObject.transform.localPosition = this.FoePoke.transform.localPosition + new Vector3(0f, 20f, 0f);
this.CatchBall.color = new Color(0f, 0f, 0f, 0f);
this.CatchBall.transform.localPosition = new Vector3(270f, 280f, 0f);
}
}
return;
}
if (this.CatchPoke == 4)
{
this.FoePoke.transform.localScale += new Vector3(2f, 2f, 2f) * Time.deltaTime;
this.FoePoke.GetComponent<UITexture>().color = new Color(this.FoePoke.transform.localScale.x, this.FoePoke.transform.localScale.x, this.FoePoke.transform.localScale.x, 1f);
if (this.FoePoke.transform.localScale.x >= 1f)
{
this.FoePoke.transform.localScale = new Vector3(1f, 1f, 1f);
this.FoePoke.GetComponent<UITexture>().color = new Color(1f, 1f, 1f, 1f);
this.CatchPoke = 0;
}
return;
}
if (this.CatchPoke == 5)
{
this.CatchBall.color = new Color(0.4f, 0.4f, 0.4f, 1f);
}
else
{
if (this.CatchPoke == 6)
{
if (Time.time > this.lastCaught + 0.5f)
{
this.CatchPoke = 2;
}
return;
}
if (this.CatchPoke == 7)
{
if (Time.time > this.lastCaught + 0.2f)
{
this.CatchPoke = 2;
}
return;
}
}
if (this.showFoe)
{
if (this.FoePoke.transform.localPosition.x > 272f)
{
this.FoePoke.transform.localPosition += new Vector3(-250f, 0f, 0f) * Time.deltaTime;
return;
}
if (this.FoePoke.transform.localPosition.x < 272f)
{
if (this.OtherForm == "_1" && (this.OtherPoke == 83 || this.OtherPoke == 161 || this.OtherPoke == 162 || this.OtherPoke == 216 || this.OtherPoke == 217 || this.OtherPoke == 234 || this.OtherPoke == 333 || this.OtherPoke == 334 || this.OtherPoke == 427 || this.OtherPoke == 428))
{
this.PlayShiny(this.FoePoke.transform, new Vector3(0f, 100f, 0f), 1);
this.PlayCry(this.OtherPoke, 0.75f);
}
else if (this.OtherShiny == "S")
{
this.PlayShiny(this.FoePoke.transform, new Vector3(0f, 30f, 0f), 0);
this.PlayCry(this.OtherPoke, 0.75f);
}
else
{
this.PlayCry(this.OtherPoke, 0f);
}
}
this.FoePoke.transform.localPosition = new Vector3(272f, this.FoePoke.transform.localPosition.y, this.FoePoke.transform.localPosition.z);
}
else if (!this.FaintFoe)
{
if (this.FoePoke.transform.localPosition.x < 500f)
{
this.FoePoke.transform.localPosition += new Vector3(500f, 0f, 0f) * Time.deltaTime;
return;
}
this.FoePoke.transform.localPosition = new Vector3(550f, this.FoePoke.transform.localPosition.y, this.FoePoke.transform.localPosition.z);
}
if (this.throwBall)
{
if (this.throwSound)
{
AudioSource.PlayClipAtPoint(this.BallSound, Camera.main.transform.position, this.SFXVolume);
this.throwSound = false;
}
if (this.ThrowObject[0].activeSelf)
{
if (this.ThrowObject[0].transform.localPosition.x < -98f)
{
this.ThrowObject[0].transform.localPosition += new Vector3(250f, 0f, 0f) * Time.deltaTime;
}
else
{
this.ThrowObject[1].SetActive(true);
this.ThrowObject[2].SetActive(true);
this.ThrowObject[0].SetActive(false);
}
}
else
{
if (this.ThrowObject[1].transform.localPosition.x > -200f)
{
this.ThrowObject[1].transform.localPosition += new Vector3(-150f, 0f, 0f) * Time.deltaTime;
}
else
{
this.ThrowObject[0].SetActive(false);
this.ThrowObject[1].SetActive(false);
}
if (!this.throwDown)
{
if (this.ThrowObject[2].transform.localPosition.y < 140f)
{
if (this.ThrowObject[2].transform.localPosition.y < 100f)
{
this.ThrowObject[2].transform.localPosition += new Vector3(0f, 300f, 0f) * Time.deltaTime;
}
else if (this.ThrowObject[2].transform.localPosition.y < 120f)
{
this.ThrowObject[2].transform.localPosition += new Vector3(0f, 150f, 0f) * Time.deltaTime;
}
else
{
this.ThrowObject[2].transform.localPosition += new Vector3(0f, 125f, 0f) * Time.deltaTime;
}
this.ThrowObject[2].transform.localPosition += new Vector3(30f, 0f, 0f) * Time.deltaTime;
this.ThrowObject[2].transform.Rotate(0f, 0f, 1000f * Time.deltaTime);
}
else
{
this.ThrowObject[0].SetActive(false);
this.ThrowObject[1].SetActive(false);
this.throwDown = true;
}
}
else if (this.ThrowObject[2].transform.localPosition.y > -10f)
{
if (this.ThrowObject[2].transform.localPosition.y > 120f)
{
this.ThrowObject[2].transform.localPosition += new Vector3(0f, -125f, 0f) * Time.deltaTime;
}
else if (this.ThrowObject[2].transform.localPosition.y > 100f)
{
this.ThrowObject[2].transform.localPosition += new Vector3(0f, -150f, 0f) * Time.deltaTime;
}
else
{
this.ThrowObject[2].transform.localPosition += new Vector3(0f, -300f, 0f) * Time.deltaTime;
}
this.ThrowObject[2].transform.localPosition += new Vector3(30f, 0f, 0f) * Time.deltaTime;
this.ThrowObject[2].transform.Rotate(0f, 0f, 1000f * Time.deltaTime);
}
else
{
this.ThrowObject[2].SetActive(false);
this.throwDown = false;
GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(this.OutOfBall);
gameObject2.transform.parent = this.UserPoke.transform.parent;
gameObject2.transform.localPosition = new Vector3(-36f, -32f, -1f);
}
if (!this.ThrowObject[2].activeSelf)
{
this.UserPoke.transform.localScale += new Vector3(2f, 2f, 2f) * Time.deltaTime;
this.UserPoke.GetComponent<UITexture>().color = new Color(this.UserPoke.transform.localScale.x, this.UserPoke.transform.localScale.x, this.UserPoke.transform.localScale.x, 1f);
if (this.UserPoke.transform.localScale.x >= 1f)
{
this.UserPoke.transform.localScale = new Vector3(1f, 1f, 1f);
this.UserPoke.GetComponent<UITexture>().color = new Color(this.UserPoke.transform.localScale.x, this.UserPoke.transform.localScale.x, this.UserPoke.transform.localScale.x, 1f);
this.throwBall = false;
if (this.Pokemons[this.SelPoke].Form == 1 && (this.Pokemons[this.SelPoke].ID == 83 || this.Pokemons[this.SelPoke].ID == 161 || this.Pokemons[this.SelPoke].ID == 162 || this.Pokemons[this.SelPoke].ID == 216 || this.Pokemons[this.SelPoke].ID == 217 || this.Pokemons[this.SelPoke].ID == 234 || this.Pokemons[this.SelPoke].ID == 333 || this.Pokemons[this.SelPoke].ID == 334 || this.Pokemons[this.SelPoke].ID == 427 || this.Pokemons[this.SelPoke].ID == 428))
{
this.PlayShiny(this.UserPoke.transform, new Vector3(0f, 130f, 0f), 1);
this.PlayCry(this.Pokemons[this.SelPoke].ID, 0.75f);
}
else if (this.Pokemons[this.SelPoke].shiny != 0)
{
this.PlayShiny(this.UserPoke.transform, new Vector3(0f, 60f, 0f), 0);
this.PlayCry(this.Pokemons[this.SelPoke].ID, 0.75f);
}
else
{
this.PlayCry(this.Pokemons[this.SelPoke].ID, 0f);
}
}
}
}
return;
}
if (this.FlashFoe)
{
this.FlashCounter += 8f * Time.deltaTime;
if (this.FlashCounter >= 0f && this.FlashCounter < 1f)
{
this.FoePoke.SetActive(false);
}
if (this.FlashCounter >= 1f && this.FlashCounter < 2f)
{
this.FoePoke.SetActive(true);
}
if (this.FlashCounter >= 2f && this.FlashCounter < 3f)
{
this.FoePoke.SetActive(false);
}
if (this.FlashCounter >= 3f && this.FlashCounter < 4f)
{
this.FoePoke.SetActive(true);
}
if (this.FlashCounter >= 4f && this.FlashCounter < 5f)
{
this.FoePoke.SetActive(false);
}
if (this.FlashCounter >= 5f)
{
this.FoePoke.SetActive(true);
this.FlashFoe = false;
}
return;
}
if (this.FlashUser)
{
this.FlashCounter += 8f * Time.deltaTime;
if (this.FlashCounter >= 0f && this.FlashCounter < 1f)
{
this.UserPoke.SetActive(false);
}
if (this.FlashCounter >= 1f && this.FlashCounter < 2f)
{
this.UserPoke.SetActive(true);
}
if (this.FlashCounter >= 2f && this.FlashCounter < 3f)
{
this.UserPoke.SetActive(false);
}
if (this.FlashCounter >= 3f && this.FlashCounter < 4f)
{
this.UserPoke.SetActive(true);
}
if (this.FlashCounter >= 4f && this.FlashCounter < 5f)
{
this.UserPoke.SetActive(false);
}
if (this.FlashCounter >= 5f)
{
this.UserPoke.SetActive(true);
this.FlashUser = false;
}
return;
}
if (this.FaintFoe)
{
if (this.FoePoke.transform.localPosition.x < 500f)
{
this.FoePoke.transform.localPosition += new Vector3(500f, 0f, 0f) * Time.deltaTime;
}
else
{
this.FoePoke.transform.localPosition = new Vector3(550f, this.FoePoke.transform.localPosition.y, this.FoePoke.transform.localPosition.z);
this.FaintFoe = false;
}
return;
}
if (this.FaintUser)
{
if (this.UserPoke.transform.localScale.x >= 0.01f)
{
this.UserPoke.transform.localScale -= new Vector3(2f, 2f, 2f) * Time.deltaTime;
this.UserPoke.GetComponent<UITexture>().color = new Color(this.UserPoke.transform.localScale.x, this.UserPoke.transform.localScale.x, this.UserPoke.transform.localScale.x, 1f);
}
else
{
this.UserPoke.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
this.UserPoke.GetComponent<UITexture>().color = new Color(this.UserPoke.transform.localScale.x, this.UserPoke.transform.localScale.x, this.UserPoke.transform.localScale.x, 1f);
this.FaintUser = false;
}
return;
}
if (this.BattleScroll && this.BattleSay != string.Empty)
{
this.hbs = 0f;
this.BLog.alpha += 2f * Time.deltaTime;
if (this.BLog.alpha < 1f)
{
return;
}
this.BLog.alpha = 1f;
if (this.BScrollTo < this.BattleSay.Length - 2)
{
if (this.BattleSay.Substring(this.BScrollTo, 2) == "[-")
{
this.BScrollTo += 3;
}
else if (this.BattleSay.Substring(this.BScrollTo, 1) == "[")
{
this.BScrollTo += 8;
}
if (this.BScrollTo < this.BattleSay.Length - 3 && this.BattleSay.Substring(this.BScrollTo, 2) == "\r\n")
{
this.BScrollCount = -50f;
if (this.SaySpeed >= 100f)
{
this.BScrollCount = -20f;
}
this.BattleLog.text = this.BattleSay.Substring(0, this.BScrollTo);
if (this.BScrollTo < this.BattleSay.Length - 3)
{
this.BattleSay = this.BattleSay.Substring(this.BScrollTo + 2);
}
this.BScrollTo = 0;
this.lineTrigger = true;
}
}
if (this.BScrollTo > this.BattleSay.Length)
{
this.BScrollTo = this.BattleSay.Length;
}
if (!this.lineTrigger)
{
this.BattleLog.text = this.BattleSay.Substring(0, this.BScrollTo);
}
this.BScrollCount += this.SaySpeed * Time.deltaTime;
if (this.BScrollCount > 1f)
{
this.lineTrigger = false;
this.BScrollTo++;
this.BScrollCount = 0f;
}
if (this.BScrollTo > this.BattleSay.Length)
{
this.BScrollTo = this.BattleSay.Length;
this.BattleScroll = false;
this.BattleLog.text = this.BattleSay;
this.BScrollCount = 0f;
}
}
else
{
this.hbs += 1f * Time.deltaTime;
if (this.hbs > 2f)
{
this.BLog.alpha += -1f * Time.deltaTime;
if (this.BLog.alpha <= 0f)
{
this.BLog.alpha = 0f;
this.hbs = 0f;
}
}
}
if (this.BLock)
{
if (this.SelectedMove)
{
this.BTimer.alpha = 0f;
}
return;
}
this.BattleIdle = true;
if (this.isPVPBattle && !this.SelectedMove && !this.endingBattle)
{
if (Time.time > this.lastPVPMove + 100f)
{
this.toDiscon = true;
}
if (this.BTimer.alpha != 0.8f)
{
this.BTimer.alpha = 0.8f;
}
this.BTimer.value = 1f - (Time.time - this.lastPVPMove) / 100f;
}
else
{
this.BTimer.alpha = 0f;
}
if (Time.time > this.LastItemUse + 0.25f && !this.chatOpen)
{
if (!this.AttackObject.activeSelf && !this.PokemonObject.activeSelf && (!this.BattleItemObject.activeSelf || this.BattleItemObject.GetComponent<UIWidget>().alpha != 1f) && !this.UseOn.activeSelf)
{
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot1) || Input.GetKeyUp(this.KeyManager.Hot1S)))
{
this.ShowAttacks();
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot2) || Input.GetKeyUp(this.KeyManager.Hot2S)))
{
this.ShowPokemon();
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot3) || Input.GetKeyUp(this.KeyManager.Hot3S)))
{
this.ShowBattleItems();
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot4) || Input.GetKeyUp(this.KeyManager.Hot4S)))
{
this.RunButton();
this.LastItemUse = Time.time;
}
}
else if (this.AttackObject.activeSelf)
{
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot1) || Input.GetKeyUp(this.KeyManager.Hot1S)))
{
this.sendAttack(1, false);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot2) || Input.GetKeyUp(this.KeyManager.Hot2S)))
{
this.sendAttack(2, false);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot3) || Input.GetKeyUp(this.KeyManager.Hot3S)))
{
this.sendAttack(3, false);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot4) || Input.GetKeyUp(this.KeyManager.Hot4S)))
{
this.sendAttack(4, false);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.CancelBut) || Input.GetKeyUp(this.KeyManager.CancelButS)))
{
this.AttackObject.SetActive(false);
this.LastItemUse = Time.time;
}
}
else if (this.PokemonObject.activeSelf)
{
if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot1) || Input.GetKeyUp(this.KeyManager.Hot1S)))
{
this.changePoke(1);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot2) || Input.GetKeyUp(this.KeyManager.Hot2S)))
{
this.changePoke(2);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot3) || Input.GetKeyUp(this.KeyManager.Hot3S)))
{
this.changePoke(3);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot4) || Input.GetKeyUp(this.KeyManager.Hot4S)))
{
this.changePoke(4);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot5) || Input.GetKeyUp(this.KeyManager.Hot5S)))
{
this.changePoke(5);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.Hot6) || Input.GetKeyUp(this.KeyManager.Hot6S)))
{
this.changePoke(6);
this.LastItemUse = Time.time;
}
else if (this.CanPressKey && (Input.GetKeyUp(this.KeyManager.CancelBut) || Input.GetKeyUp(this.KeyManager.CancelButS)))
{
this.PokemonObject.SetActive(false);
this.LastItemUse = Time.time;
}
}
else if (this.BattleItemObject.activeSelf && this.BattleItemObject.GetComponent<UIWidget>().alpha == 1f && this.CanPressKey && (Input.GetKeyUp(this.KeyManager.CancelBut) || Input.GetKeyUp(this.KeyManager.CancelButS)))
{
this.BattleItemObject.SetActive(false);
this.LastItemUse = Time.time;
}
}
}
private void PlayCry(int ID, float Delay = 0f)
{
if (Delay > 0f)
{
base.StartCoroutine(this.PlayCryLate(ID, Delay));
return;
}
if (ID < 10)
{
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Cry/00" + ID.ToString()), Camera.main.transform.position, this.SFXVolume);
}
else if (ID < 100)
{
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Cry/0" + ID.ToString()), Camera.main.transform.position, this.SFXVolume);
}
else
{
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Cry/" + ID.ToString()), Camera.main.transform.position, this.SFXVolume);
}
}
[DebuggerHidden]
private IEnumerator PlayCryLate(int ID, float Delay)
{
DSSock.<PlayCryLate>c__IteratorD <PlayCryLate>c__IteratorD = new DSSock.<PlayCryLate>c__IteratorD();
<PlayCryLate>c__IteratorD.Delay = Delay;
<PlayCryLate>c__IteratorD.ID = ID;
<PlayCryLate>c__IteratorD.<$>Delay = Delay;
<PlayCryLate>c__IteratorD.<$>ID = ID;
<PlayCryLate>c__IteratorD.<>f__this = this;
return <PlayCryLate>c__IteratorD;
}
private void PlayShiny(Transform ParentTransform, Vector3 Offset, int Holiday = 0)
{
if (Holiday == 1)
{
GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.XmasSparkle);
gameObject.transform.parent = ParentTransform.parent;
gameObject.transform.localPosition = ParentTransform.localPosition + Offset;
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[70], Camera.main.transform.position, this.SFXVolume);
}
else
{
GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(this.ShinySparkle);
gameObject2.transform.parent = ParentTransform.parent;
gameObject2.transform.localPosition = ParentTransform.localPosition + Offset;
AudioSource.PlayClipAtPoint(this.musicPlayer.MusicFiles[70], Camera.main.transform.position, this.SFXVolume);
}
}
public void HideBattle()
{
this.BattleItemObject.SetActive(false);
this.BattleLog.text = string.Empty;
this.BScrollCount = 0f;
this.BScrollTo = 0;
this.BattleScroll = false;
this.FaintUser = false;
this.endingBattle = false;
this.FaintFoe = false;
this.CatchPoke = 0;
this.CatchShakes = 1;
this.lockBattle = false;
this.outrage = false;
if (this.LoggedIn)
{
this.PlayMusic(this.mapMusic);
}
this.BattleScreen.SetActive(false);
this.BattleBlanker.gameObject.SetActive(false);
this.inBattle = false;
this.CatchPokemon = false;
}
private void SetStatus(int ID, string Status)
{
if (Status == null)
{
Status = string.Empty;
}
if (ID == 0)
{
if (Status == string.Empty || Status == "0")
{
this.PokeStatus[0].alpha = 0f;
}
else
{
this.PokeStatus[0].spriteName = Status;
this.PokeStatus[0].alpha = 1f;
}
}
else
{
this.OtherStatus = Status;
if (Status == string.Empty || Status == "0")
{
this.PokeStatus[1].alpha = 0f;
}
else
{
this.PokeStatus[1].spriteName = Status;
this.PokeStatus[1].alpha = 1f;
}
}
}
[DebuggerHidden]
private IEnumerator BattleText(string StringData)
{
DSSock.<BattleText>c__IteratorE <BattleText>c__IteratorE = new DSSock.<BattleText>c__IteratorE();
<BattleText>c__IteratorE.StringData = StringData;
<BattleText>c__IteratorE.<$>StringData = StringData;
<BattleText>c__IteratorE.<>f__this = this;
return <BattleText>c__IteratorE;
}
private void DeleteBattleItems()
{
foreach (Transform transform in this.BattleItemParent)
{
UnityEngine.Object.Destroy(transform.gameObject);
}
}
public void ShowBattleItems()
{
if (this.Pokemons[this.SelPoke].hpleft <= 0)
{
return;
}
this.AttackObject.SetActive(false);
this.PokemonObject.SetActive(false);
this.BattleItemObject.GetComponent<UIWidget>().alpha = 1f;
this.BattleItemObject.SetActive(true);
this.DeleteBattleItems();
this.BattleItemObject.SetActive(false);
if (this.Items.Count > 0)
{
for (int i = 0; i < this.Items.Count; i++)
{
if (this.Items[i].Scope == 5 && this.Items[i].QTY > 0 && this.Items[i].ID != 54)
{
InventoryButton inventoryButton = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject);
inventoryButton.Sock = this;
inventoryButton.transform.parent = this.BattleItemParent;
inventoryButton.QTY = this.Items[i].QTY;
inventoryButton.IName = this.Items[i].ItemName;
inventoryButton.ID = this.Items[i].ID;
inventoryButton.name = inventoryButton.IName;
inventoryButton.Scope = this.Items[i].Scope;
inventoryButton.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton.UpdateIcon();
}
}
for (int j = 0; j < this.Items.Count; j++)
{
if (this.Items[j].Scope == 2 && this.Items[j].QTY > 0 && this.Items[j].ID != 54)
{
InventoryButton inventoryButton2 = UnityEngine.Object.Instantiate<InventoryButton>(this.ItemObject);
inventoryButton2.Sock = this;
inventoryButton2.transform.parent = this.BattleItemParent;
inventoryButton2.QTY = this.Items[j].QTY;
inventoryButton2.IName = this.Items[j].ItemName;
inventoryButton2.ID = this.Items[j].ID;
inventoryButton2.name = inventoryButton2.IName;
inventoryButton2.Scope = this.Items[j].Scope;
inventoryButton2.transform.localScale = new Vector3(1f, 1f, 1f);
inventoryButton2.transform.localPosition = new Vector3(0f, 0f, 0f);
inventoryButton2.UpdateIcon();
}
}
}
this.BattleItemObject.SetActive(true);
this.BattleItemParent.GetComponent<UIGrid>().Reposition();
this.BattleItemParent.transform.parent.GetComponent<UIScrollView>().ResetPosition();
this.BattleButtons[3].SetState(UIButtonColor.State.Hover, true);
this.BattleButtons[3].enabled = false;
this.BattleButtons[3].SetState(UIButtonColor.State.Hover, true);
this.BattleButtons[1].enabled = true;
this.BattleButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[0].enabled = true;
this.BattleButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[2].enabled = true;
this.BattleButtons[2].SetState(UIButtonColor.State.Normal, true);
}
public void ShowAttacks()
{
for (int i = 0; i < 4; i++)
{
if (this.Pokemons[this.SelPoke].Attack[i] != string.Empty)
{
this.AttackNames[i].transform.parent.gameObject.SetActive(true);
this.AttackNames[i].text = this.Pokemons[this.SelPoke].Attack[i];
this.AttackPP[i].text = this.Pokemons[this.SelPoke].PPL[i].ToString() + "/" + this.Pokemons[this.SelPoke].PP[i].ToString();
this.AttackElement[i].spriteName = this.Atks.GetType(this.Pokemons[this.SelPoke].Attack[i]);
this.AttackType[i].spriteName = this.Atks.GetElement(this.Pokemons[this.SelPoke].Attack[i]);
}
else
{
this.AttackNames[i].transform.parent.gameObject.SetActive(false);
this.AttackNames[i].text = string.Empty;
}
}
this.BattleButtons[0].enabled = false;
this.BattleButtons[0].SetState(UIButtonColor.State.Hover, true);
this.BattleButtons[1].enabled = true;
this.BattleButtons[1].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[2].enabled = true;
this.BattleButtons[2].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[3].enabled = true;
this.BattleButtons[3].SetState(UIButtonColor.State.Normal, true);
this.UseOn.SetActive(false);
this.AttackObject.SetActive(true);
this.PokemonObject.SetActive(false);
this.BattleItemObject.SetActive(false);
}
public void ShowPokemon()
{
this.UseOn.SetActive(false);
if (this.PokemonObject.activeSelf)
{
return;
}
this.BatonPass = false;
for (int i = 0; i < 6; i++)
{
if (i < this.Pokemons.Count)
{
string str = string.Empty;
if (this.Pokemons[i].Form > 0)
{
str = "_" + this.Pokemons[i].Form.ToString();
}
this.PokemonNames[i].mainTexture = Resources.Load<Texture>("SmallPokemon/" + this.Pokemons[i].ID.ToString() + str);
if (this.Pokemons[i].hpleft <= 0)
{
this.PokemonNames[i].transform.parent.GetComponent<UIButton>().enabled = false;
this.PokemonNames[i].transform.parent.GetComponent<UIButton>().SetState(UIButtonColor.State.Disabled, true);
}
else
{
this.PokemonNames[i].transform.parent.GetComponent<UIButton>().enabled = true;
this.PokemonNames[i].transform.parent.GetComponent<UIButton>().SetState(UIButtonColor.State.Normal, true);
}
}
else
{
this.PokemonNames[i].mainTexture = null;
}
}
this.BattleButtons[1].enabled = false;
this.BattleButtons[1].SetState(UIButtonColor.State.Hover, true);
this.BattleButtons[0].enabled = true;
this.BattleButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[2].enabled = true;
this.BattleButtons[2].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[3].enabled = true;
this.BattleButtons[3].SetState(UIButtonColor.State.Normal, true);
this.AttackObject.SetActive(false);
this.PokemonObject.SetActive(true);
this.BattleItemObject.SetActive(false);
}
public void RunButton()
{
this.UseOn.SetActive(false);
this.BattleItemObject.SetActive(false);
if (!this.BLock && this.Pokemons[this.SelPoke].hpleft > 0)
{
this.BattleButtons[3].enabled = true;
this.BattleButtons[3].SetState(UIButtonColor.State.Hover, true);
this.BattleButtons[0].enabled = true;
this.BattleButtons[0].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[2].enabled = true;
this.BattleButtons[2].SetState(UIButtonColor.State.Normal, true);
this.BattleButtons[2].enabled = true;
this.BattleButtons[2].SetState(UIButtonColor.State.Normal, true);
this.BLock = true;
this.sendPacket("(|.|5");
}
}
public void sendAttack(int ID, bool sendAnyway = false)
{
if (sendAnyway)
{
this.BLock = true;
this.sendPacket("(|.|" + ID.ToString());
this.SelectedMove = true;
}
else
{
if (this.Pokemons[this.SelPoke].Attack[ID - 1] == string.Empty)
{
return;
}
if (!this.BLock && this.Pokemons[this.SelPoke].hpleft > 0)
{
if (this.Pokemons[this.SelPoke].Attack[ID - 1] == "Baton Pass")
{
this.BatonID = ID;
this.ShowPokemon();
this.BatonPass = true;
return;
}
this.BLock = true;
this.AttackObject.SetActive(false);
this.sendPacket("(|.|" + ID.ToString());
this.SelectedMove = true;
}
}
}
public void changePoke(int thisID)
{
if (thisID > this.Pokemons.Count)
{
return;
}
if (this.SelPoke != thisID - 1 && !this.BLock && this.Pokemons[thisID - 1].hpleft > 0)
{
this.BLock = true;
this.PokemonObject.SetActive(false);
if (this.BatonPass)
{
this.sendPacket("(|.|" + (5 + thisID).ToString() + "|.|" + this.BatonID.ToString());
this.SelectedMove = true;
this.BatonPass = false;
this.BatonID = 0;
}
else
{
this.sendPacket("(|.|" + (5 + thisID).ToString());
this.SelectedMove = true;
}
}
}
public void StartPMWith(string username)
{
string text = username + "-=-" + this.Players.pname;
string[] array = text.Split(new string[]
{
"-=-"
}, StringSplitOptions.None);
if (text.ToLower() == this.Players.pname.ToLower())
{
return;
}
if (text.ToLower() == this.user.value.ToLower())
{
return;
}
if (this.PMs.Count <= 0)
{
GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.PMObject);
gameObject.transform.parent = this.GUIObjects.transform;
gameObject.transform.localPosition = new Vector3(0f, 0f, 0f);
gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
this.lastPMBox++;
if (this.lastBox > 20)
{
this.lastBox = 0;
}
gameObject.GetComponent<UIPanel>().depth = 10 + this.lastPMBox;
PMBox component = gameObject.GetComponent<PMBox>();
component.Participants = text;
component.Title.text = "MSG - " + component.Participants.Replace("-=-", ", ");
component.Title.text = component.Title.text.Replace(", " + this.Players.pname, string.Empty);
component.Title.text = component.Title.text.Replace(this.Players.pname + ", ", string.Empty);
List<GameObject> pMs = this.PMs;
lock (pMs)
{
this.PMs.Add(gameObject);
}
return;
}
int num = 0;
if (num >= this.PMs.Count)
{
return;
}
string[] array2 = this.PMs[num].GetComponent<PMBox>().Participants.Split(new string[]
{
"-=-"
}, StringSplitOptions.None);
bool flag = true;
for (int i = 0; i < array.Length; i++)
{
bool flag2 = false;
for (int j = 0; j < array2.Length; j++)
{
if (array2[j].ToLower() == array[i].ToLower())
{
flag2 = true;
}
}
if (!flag2)
{
flag = false;
}
}
if (flag)
{
return;
}
GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(this.PMObject);
gameObject2.transform.parent = this.GUIObjects.transform;
gameObject2.transform.localPosition = new Vector3(0f, 0f, 0f);
gameObject2.transform.localScale = new Vector3(1f, 1f, 1f);
this.lastPMBox++;
if (this.lastBox > 20)
{
this.lastBox = 0;
}
gameObject2.GetComponent<UIPanel>().depth = 10 + this.lastPMBox;
PMBox component2 = gameObject2.GetComponent<PMBox>();
component2.Participants = text;
component2.Title.text = "MSG - " + component2.Participants.Replace("-=-", ", ");
component2.Title.text = component2.Title.text.Replace(", " + this.Players.pname, string.Empty);
component2.Title.text = component2.Title.text.Replace(this.Players.pname + ", ", string.Empty);
List<GameObject> pMs2 = this.PMs;
lock (pMs2)
{
this.PMs.Add(gameObject2);
}
}
public void MSGBOX(string Title, string Message, bool yesno = false)
{
this.lastBox++;
if (this.lastBox > 50)
{
this.lastBox = 0;
}
GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.MessageBox);
gameObject.transform.parent = this.GUIObjects.transform;
gameObject.transform.localPosition = new Vector3(0f, (float)(0 + UnityEngine.Random.Range(-20, 80)), 0f);
gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
gameObject.GetComponent<UIPanel>().depth = 30 + this.lastBox;
gameObject.GetComponent<HandleBox>().Tag = string.Empty;
gameObject.GetComponent<HandleBox>().Message = Message;
gameObject.GetComponent<HandleBox>().Title = Title;
gameObject.GetComponent<HandleBox>().YesNo = yesno;
gameObject.GetComponent<HandleBox>().init();
gameObject.name = Title;
}
public void ClickDonate()
{
Application.OpenURL(DSSock.dLink);
}
public void BuyCoins()
{
string text = this.user.value.ToLower();
Regex regex = new Regex("[^a-zA-Z0-9]");
text = regex.Replace(text, string.Empty);
if (this.ServerSelect.value == "PRO Red Server")
{
Application.OpenURL("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3E57KHNFJGJNN&custom=" + text);
}
else if (this.ServerSelect.value == "PRO Blue Server")
{
Application.OpenURL("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=V6EJE38B5KFBN&custom=" + text);
}
this.MSGBOX("Purchasing Coins", "After your payment has been verified\n[33CCFF](This may take awhile)[-]\nYou will need to RELOG for Coins to be added.", false);
}
public void ClickReport()
{
Application.OpenURL(DSSock.BugLink);
}
private bool IsEmote(string m)
{
return m.IndexOf(" em(") != -1;
}
public void Resync()
{
if (Time.time > this.lastSync + 2f)
{
this.lastSync = Time.time;
this.sendMSG("/syn");
}
}
private bool DoEmote(showEmote s, string m)
{
if (m == " em(1)")
{
s.Show(1, 1);
return true;
}
if (m == " em(2)")
{
s.Show(2, 1);
return true;
}
if (m == " em(3)")
{
s.Show(3, 1);
return true;
}
if (m == " em(4)")
{
s.Show(4, 1);
return true;
}
if (m == " em(5)")
{
s.Show(5, 1);
return true;
}
if (m == " em(6)")
{
s.Show(6, 1);
return true;
}
if (m == " em(7)")
{
s.Show(7, 1);
return true;
}
if (m == " em(8)")
{
s.Show(8, 1);
return true;
}
if (m == " em(9)")
{
s.Show(9, 1);
return true;
}
if (m == " em(10)")
{
s.Show(10, 1);
return true;
}
if (m == " em(11)")
{
s.Show(11, 1);
return true;
}
if (m == " em(12)")
{
s.Show(12, 1);
return true;
}
if (m == " em(13)")
{
s.Show(13, 1);
return true;
}
if (m == " em(14)")
{
s.Show(14, 1);
return true;
}
if (m == " em(15)")
{
s.Show(15, 1);
return true;
}
if (m == " em(16)")
{
s.Show(16, 1);
return true;
}
if (m == " em(17)")
{
s.Show(17, 1);
return true;
}
if (m == " em(18)")
{
s.Show(18, 1);
return true;
}
if (m == " em(19)")
{
s.Show(19, 1);
return true;
}
if (m == " em(20)")
{
s.Show(20, 1);
return true;
}
if (m == " em(21)")
{
s.Show(21, 1);
return true;
}
if (m == " em(22)")
{
s.Show(22, 1);
return true;
}
if (m == " em(23)")
{
s.Show(23, 1);
return true;
}
if (m == " em(24)")
{
s.Show(24, 1);
return true;
}
if (m == " em(25)")
{
s.Show(25, 1);
return true;
}
if (m == " em(26)")
{
s.Show(26, 1);
return true;
}
if (m == " em(27)")
{
s.Show(27, 1);
return true;
}
if (m == " em(28)")
{
s.Show(28, 1);
return true;
}
if (m == " em(29)")
{
s.Show(29, 1);
return true;
}
return false;
}
public void FindMatch()
{
if (Time.time > this.LastQueue + 0.5f)
{
this.sendMSG("/match");
this.LastQueue = Time.time;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment