//********************************************************************************************* // ThrowNpc / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Empurra determinado NPC para determinada direção e distância //********************************************************************************************* public static void throwNpc(int Map, int s, int dir, int range) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, Map, s, dir, range) != null) { return; } //CÓDIGO switch (dir) { case 8: NpcStruct.tempnpc[Map, s].Y = Convert.ToByte(NpcStruct.tempnpc[Map, s].Y - range); break; case 2: NpcStruct.tempnpc[Map, s].Y = Convert.ToByte(NpcStruct.tempnpc[Map, s].Y + range); break; case 4: NpcStruct.tempnpc[Map, s].X = Convert.ToByte(NpcStruct.tempnpc[Map, s].X - range); break; case 6: NpcStruct.tempnpc[Map, s].X = Convert.ToByte(NpcStruct.tempnpc[Map, s].X + range); break; default: WinsockAsync.Log(String.Format("Direção nula")); break; } SendData.sendKnockBack(Map, 2, s, dir, range); }
//********************************************************************************************* // CanplayerAttackNpc / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Verifica se determinado jogador pode atacar determinado npc no contexto em que está //********************************************************************************************* public static bool canPlayerAttackNpc(int Attacker, int Victim) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, Attacker, Victim) != null) { return(Convert.ToBoolean(Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, Attacker, Victim))); } //CÓDIGO int Map = character[Attacker, player[Attacker].SelectedChar].Map; int Dir = character[Attacker, player[Attacker].SelectedChar].Dir; int NpcX = 0; int NpcY = 0; int PlayerX = character[Attacker, player[Attacker].SelectedChar].X; int PlayerY = character[Attacker, player[Attacker].SelectedChar].Y; if (NpcStruct.tempnpc[Map, Victim].Dead == true) { return(false); } //if (NpcStruct.tempnpc[Map, Victim].guildnum == character[Attacker, player[Attacker].SelectedChar].Guild) { return false; } switch (Dir) { case 8: NpcX = NpcStruct.tempnpc[Map, Victim].X; NpcY = NpcStruct.tempnpc[Map, Victim].Y + 1; break; case 2: NpcX = NpcStruct.tempnpc[Map, Victim].X; NpcY = NpcStruct.tempnpc[Map, Victim].Y - 1; break; case 4: NpcX = NpcStruct.tempnpc[Map, Victim].X + 1; NpcY = NpcStruct.tempnpc[Map, Victim].Y; break; case 6: NpcX = NpcStruct.tempnpc[Map, Victim].X - 1; NpcY = NpcStruct.tempnpc[Map, Victim].Y; break; default: WinsockAsync.Log(String.Format("Direção nula")); return(false); } if ((NpcX == PlayerX) && (NpcY == PlayerY)) { return(true); } return(false); }
//********************************************************************************************* // PlayerMove / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Move determinado jogador para determinada posição //********************************************************************************************* public static void playerMove(int s, byte Dir) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, s, Dir) != null) { return; } //CÓDIGO if (PlayerStruct.tempplayer[s].Warping) { return; } //Tentamos nos mover switch (Dir) { case 8: PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Y = Convert.ToByte(Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Y) - 1); PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Dir = Globals.DirUp; break; case 2: PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Y = Convert.ToByte(Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Y) + 1); PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Dir = Globals.DirDown; break; case 4: PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].X = Convert.ToByte(Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].X) - 1); PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Dir = Globals.DirLeft; break; case 6: PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].X = Convert.ToByte(Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].X) + 1); PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Dir = Globals.DirRight; break; default: WinsockAsync.Log(String.Format("Direção nula")); break; } int map = Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Map); int x = Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].X); int y = Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Y); //Verifica os tipos de tiles if (MapStruct.tile[map, x, y].Data1 == "2") { PlayerStruct.tempplayer[s].Warping = true; playerWarp(s, Convert.ToInt32(MapStruct.tile[map, x, y].Data2), Convert.ToByte(MapStruct.tile[map, x, y].Data3), Convert.ToByte(MapStruct.tile[map, x, y].Data4)); return; } //Se nenhum tile tem ação, enviar as novas coordenadas do jogador após o movimento SendData.sendPlayerXY(s); SendData.sendPlayerDir(s, 1); }
//********************************************************************************************* // ConsoleEventCallBack / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Desconectar usuários antes de fechar o servidor. //********************************************************************************************* static bool ConsoleEventCallback(int eventType) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, eventType) != null) { return(Convert.ToBoolean(Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, eventType))); } //CÓDIGO if (eventType == 2) { for (int i = 0; i <= WinsockAsync.Clients.Count; i++) { WinsockAsync.disconnectUser(i); } } return(false); }
//********************************************************************************************* // ThrowPlayer / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Empurra determinado jogador para determinada direção e distância //********************************************************************************************* public static void throwPlayer(int s, int dir, int range) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, s, dir, range) != null) { return; } //CÓDIGO int map = character[s, player[s].SelectedChar].Map; int x = character[s, player[s].SelectedChar].X; int y = character[s, player[s].SelectedChar].Y; switch (dir) { case 8: character[s, player[s].SelectedChar].Y = Convert.ToByte(Convert.ToInt32(character[s, player[s].SelectedChar].Y) - range); break; case 2: character[s, player[s].SelectedChar].Y = Convert.ToByte(Convert.ToInt32(character[s, player[s].SelectedChar].Y) + range); break; case 4: character[s, player[s].SelectedChar].X = Convert.ToByte(Convert.ToInt32(character[s, player[s].SelectedChar].X) - range); break; case 6: character[s, player[s].SelectedChar].X = Convert.ToByte(Convert.ToInt32(character[s, player[s].SelectedChar].X) + range); break; default: WinsockAsync.Log(String.Format("Direção nula")); break; } SendData.sendKnockBack(map, 1, s, dir, range); }
//********************************************************************************************* // AlphaLoop / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Trabalha com informações direcionadas ao jogo e os jogadores. //********************************************************************************************* public static void AlphaLoop() { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name) != null) { return; } //CÓDIGO long tmr100; long tmr256; long Tick; tmr100 = 0; tmr256 = 0; Database.Handler.defineAdmin(); WinsockAsync.Log(lang.server_started_in_date + " " + DateTime.Now); do { Tick = TickCount.ElapsedMilliseconds; //EXTEND if (Extensions.ExtensionApp.extendMyApp ("alpha_inject", Tick) != null) { return; } //WinsockAsync.Listen(); Command = "First For"; for (int i = 1; i <= Globals.Player_Highs; i++) { if (PlayerStruct.tempplayer[i].ingame) { PetRelations.petMove(i); } if ((PlayerStruct.tempplayer[i].SORE) && (PlayerStruct.character[i, PlayerStruct.player[i].SelectedChar].PVPPenalty < Loops.TickCount.ElapsedMilliseconds)) { PlayerStruct.tempplayer[i].SORE = false; PlayerStruct.character[i, PlayerStruct.player[i].SelectedChar].PVPPenalty = 0; SendData.sendPlayerSoreToMap(i); SendData.sendAnimation(PlayerStruct.character[i, PlayerStruct.player[i].SelectedChar].Map, Globals.Target_Player, i, 148); } for (int p = 1; p < Globals.MaxPassiveEffects; p++) { if ((PlayerStruct.ppassiveffect[i, p].active) && (Tick > PlayerStruct.ppassiveffect[i, p].timer)) { SkillRelations.executePassiveEffect(i, p); } } if (PlayerStruct.tempplayer[i].RegenTimer < Tick) { PlayerRelations.playerRegen(i); } if ((PlayerStruct.tempplayer[i].preparingskill > 0) && (Tick > PlayerStruct.tempplayer[i].skilltimer)) { PlayerLogic.ExecuteSkill(i); } //Dano sobre tempo for (int s = 1; s < Globals.MaxNTempSpells; s++) { if ((PlayerStruct.ptempspell[i, s].active) && (Tick > PlayerStruct.ptempspell[i, s].timer)) { SkillRelations.executeTempSpell(i, s); } } if ((PlayerStruct.tempplayer[i].Stunned) && (PlayerStruct.tempplayer[i].StunTimer < Tick)) { SendData.sendStun(PlayerStruct.character[i, PlayerStruct.player[i].SelectedChar].Map, 1, i, 0); PlayerStruct.tempplayer[i].Stunned = false; } if ((PlayerStruct.tempplayer[i].Sleeping) && (PlayerStruct.tempplayer[i].SleepTimer < Tick)) { SendData.sendSleep(PlayerStruct.character[i, PlayerStruct.player[i].SelectedChar].Map, 1, i, 0); PlayerStruct.tempplayer[i].Sleeping = false; } if ((PlayerStruct.tempplayer[i].Blind) && (PlayerStruct.tempplayer[i].BlindTimer < Tick)) { //SendData.sendStun(PlayerStruct.character[i, PlayerStruct.player[i].SelectedChar].Map, 1, i, 0); PlayerStruct.tempplayer[i].Blind = false; } if ((PlayerStruct.tempplayer[i].Slowed) && (PlayerStruct.tempplayer[i].SlowTimer < Tick)) { if (PlayerStruct.tempplayer[i].isFrozen) { PlayerStruct.tempplayer[i].isFrozen = false; SendData.sendFrozen(Globals.Target_Player, i); } PlayerStruct.tempplayer[i].Slowed = false; PlayerStruct.tempplayer[i].movespeed = Globals.NormalMoveSpeed; SendData.sendMoveSpeed(Globals.Target_Player, i); } } Command = "tmr100"; if (tmr100 < Tick) { for (int i = 0; i <= WinsockAsync.Clients.Count - 1; i++) { if (!WinsockAsync.Clients[i].IsConnected) { if (WinsockAsync.Clients[i].s >= 0) { WinsockAsync.disconnectUser(i); } } } for (int i = 0; i <= Globals.Max_WorkPoints - 1; i++) { if ((MapStruct.tempworkpoint[i].respawn > 0) && (Loops.TickCount.ElapsedMilliseconds > MapStruct.tempworkpoint[i].respawn)) { MapStruct.tempworkpoint[i].vitality = MapStruct.workpoint[i].vitality; MapStruct.tempworkpoint[i].respawn = 0; SendData.sendEventGraphicToMap(MapStruct.workpoint[i].map, MapStruct.tile[MapStruct.workpoint[i].map, MapStruct.workpoint[i].x, MapStruct.workpoint[i].y].Event_Id, "", 0, Convert.ToByte(MapStruct.workpoint[i].active_sprite)); } } tmr100 = Tick + 100; } Command = "tmr256"; if (tmr256 < Tick) { for (int i = 0; i < Globals.MaxMaps; i++) { MapStruct.CheckMapItems(i); if (MapStruct.tempmap[i].WarActive) { if (Tick > MapStruct.tempmap[i].WarTimer) { bool b = false; for (int i2 = 0; i2 <= MapStruct.tempmap[i].NpcCount; i2++) { if (NpcStruct.tempnpc[i, i2].guildnum > 0) { if (NpcStruct.tempnpc[i, i2].Target > 0) { MapStruct.tempmap[i].WarTimer += Tick + 20000; b = true; } NpcStruct.RegenNpc(i, i2, true); } } if (b) { break; } SendData.sendMsgToGuild(MapStruct.map[i].guildnum, lang.the_colector_of + " " + MapStruct.map[i].name + " " + lang.has_survived, Globals.ColorYellow, Globals.Msg_Type_Server); MapStruct.tempmap[i].WarActive = false; } } Command = "NPC COUNT"; for (int i2 = 0; i2 <= MapStruct.tempmap[i].NpcCount; i2++) { if (i2 > 0) { Command = "TIME DAMAGE"; //Dano sobre tempo for (int s = 1; s < Globals.MaxNTempSpells; s++) { if ((NpcStruct.ntempspell[i, i2, s].active) && (Tick > NpcStruct.ntempspell[i, i2, s].timer)) { NpcStruct.ExecuteTempSpell(i, i2, s); } } //Processamento do NPC if (MapStruct.ExistPlayerInMap(i)) { Command = "NPC MOVE"; NpcIA.CheckNpcMove(i, i2); if ((NpcStruct.tempnpc[i, i2].preparingskill > 0) && (Tick > NpcStruct.tempnpc[i, i2].skilltimer)) { Command = "NPC EXECUTE SKILL"; NpcIA.ExecuteSkill(i, i2); } if (NpcStruct.tempnpc[i, i2].RegenTimer < Tick) { Command = "REGEN NPC"; NpcStruct.RegenNpc(i, i2); } if ((NpcStruct.tempnpc[i, i2].Stunned) && (NpcStruct.tempnpc[i, i2].StunTimer < Tick)) { Command = "NPC STUN"; SendData.sendStun(i, 2, i2, 0); NpcStruct.tempnpc[i, i2].Stunned = false; } if ((NpcStruct.tempnpc[i, i2].Sleeping) && (NpcStruct.tempnpc[i, i2].SleepTimer < Tick)) { Command = "NPC SLEEP"; SendData.sendSleep(i, 2, i2, 0); NpcStruct.tempnpc[i, i2].Sleeping = false; } if ((NpcStruct.tempnpc[i, i2].Blind) && (NpcStruct.tempnpc[i, i2].BlindTimer < Tick)) { Command = "NPC BLIND"; // A fazer SendData.sendStun(i, 2, i2, 0); NpcStruct.tempnpc[i, i2].Blind = false; } if ((NpcStruct.tempnpc[i, i2].Slowed) && (NpcStruct.tempnpc[i, i2].SlowTimer < Tick)) { if (NpcStruct.tempnpc[i, i2].isFrozen) { NpcStruct.tempnpc[i, i2].isFrozen = false; SendData.sendFrozen(Globals.Target_Npc, i2, i); } NpcStruct.tempnpc[i, i2].Slowed = false; NpcStruct.tempnpc[i, i2].movespeed = Globals.NormalMoveSpeed; SendData.sendMoveSpeed(Globals.Target_Npc, i2, i); } } else { Command = "NPC SUPER REGEN"; NpcStruct.RegenNpc(i, i2, true); if (NpcStruct.tempnpc[i, i2].Target > 0) { NpcStruct.tempnpc[i, i2].Target = 0; } } Command = "NPC RESPAWN"; if ((NpcStruct.tempnpc[i, i2].Dead == true) && (Tick > NpcStruct.tempnpc[i, i2].RespawnTimer)) { //Respawn NpcIA.NpcRespawned(i, i2); } } } //for (int i2 = 0; i2 <= MapStruct.Ge; i2++) // { //} } tmr256 = Tick + 256; } long test1 = Tick; Command = "save Timer"; if (save_Timer < TickCount.ElapsedMilliseconds) { //Salva o jogador SE PRECISAR if (WinsockAsync.Clients.Count > 0) { for (int i = 0; i < WinsockAsync.Clients.Count; i++) { if (PlayerStruct.tempplayer[WinsockAsync.Clients[i].s].ingame) { Database.Characters.saveCharacter(WinsockAsync.Clients[i].s, PlayerStruct.player[WinsockAsync.Clients[i].s].Email, PlayerStruct.player[WinsockAsync.Clients[i].s].SelectedChar); Database.Banks.saveBank(WinsockAsync.Clients[i].s); } } } save_Timer = TickCount.ElapsedMilliseconds + 600000; Console.WriteLine(lang.server_has_been_saved); } Command = "TPP"; if ((test1 - Tick) > 0) { Console.WriteLine("TPP: " + (test1 - Tick)); } Thread.Sleep(10); }while (true); }
//********************************************************************************************* // Main / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Iniciamos o servidor aqui. //********************************************************************************************* static void Main(string[] args) { loadLang(); Console.WriteLine(""); Console.WriteLine("///////////////////////////////////////////////////////"); Console.WriteLine("/ /"); Console.WriteLine(@"/ ___ _ /"); Console.WriteLine(@"/ / __\__ _ __(_) ___ _ __ _ _ _ __ ___ /"); Console.WriteLine(@"/ / _\/ _ \| '__| |/ _ \ '__| | | | '_ ` _ \ /"); Console.WriteLine(@"/ / / | (_) | | | | __/ | | |_| | | | | | | /"); Console.WriteLine(@"/ \/ \___/|_| _/ |\___|_| \__,_|_| |_| |_| /"); Console.WriteLine(@"/ |__/ /"); Console.WriteLine("/ /"); Console.WriteLine("/ http://4tabern.com /"); Console.WriteLine("/ Copyright (C) 2016 Allyson S. Bacon /"); Console.WriteLine("/ /"); Console.WriteLine("///////////////////////////////////////////////////////"); Console.WriteLine(""); Console.WriteLine(lang.making_the_query_extensions_in_project); Extensions.ExtensionApp.instanceTypes(); //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, args) != null) { return; } //CÓDIGO PARA RESETAR JOGADORES //PlayerStruct.InitializePlayerArrays(); //Database.ResetAndGiveExp(); Log(Languages.LStruct.lang.starting_server); Log(lang.setting_global_names); Globals.GAME_NAME = Database.Handler.getGameName(); Globals.MOTD = Database.Handler.getMOTD(); Globals.NOTICE = Database.Handler.getNotice(); Log(lang.starting_server); Log(lang.client_defined); Log(""); Log(lang.starting_player_arrays); PlayerStruct.initializePlayerArrays(); Log(lang.starting_guild_arrays); GuildStruct.initializeGuildArrays(); Log(lang.arrays_started); Log(""); Log(lang.loading_enemies); Database.Enemies.loadEnemies(); Log(lang.loaded); Log(lang.loading_maps_monsters_and_missions); Database.Maps.loadAll(); Log(lang.loaded); Log(lang.loading_items); Database.Items.loadItems(); Log(lang.loaded); Log(lang.loading_weapons); Database.Weapons.loadWeapons(); Log(lang.loaded); Log(lang.loading_armors); Database.Armors.loadArmors(); Log(lang.loaded); Log(lang.loading_skills); Database.Skills.loadSkills(); Log(lang.loaded); Log(lang.loading_shops); Database.Shops.loadShops(); //Rudimentar :/ Database.Manual.loadShopsRud(); Log(lang.loaded); Log(lang.loading_recipes); Database.Manual.loadRecipes(); Log(lang.loaded); Log(lang.loading_guilds); Database.Guilds.loadGuilds(); Log(lang.loaded); Log(lang.loading_classes); Database.Handler.defineClassesData(); Log(lang.loaded); Log(""); Log(lang.setting_variables); rdn = new Random(); Log(lang.OK); Log(""); Log(lang.starting_server_loop); Log(lang.starting_tcpip_connection); WinsockAsync.start(); }
//********************************************************************************************* // CanplayerAttackPlayer / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Verifica se determinado jogador pode atacar outro jogador determinado no contexto em que // ambos estão. //********************************************************************************************* public static bool canPlayerAttackPlayer(int Attacker, int Victim) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, Attacker, Victim) != null) { return(Convert.ToBoolean(Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, Attacker, Victim))); } //CÓDIGO int Map = Convert.ToInt32(character[Attacker, player[Attacker].SelectedChar].Map); int Dir = character[Attacker, player[Attacker].SelectedChar].Dir; int VictimX = character[Victim, player[Victim].SelectedChar].X; int VictimY = character[Victim, player[Victim].SelectedChar].Y; int PlayerX = character[Attacker, player[Attacker].SelectedChar].X; int PlayerY = character[Attacker, player[Attacker].SelectedChar].Y; if (tempplayer[Victim].isDead == true) { return(false); } if (!MapStruct.tempmap[Map].WarActive) { if (character[Victim, player[Victim].SelectedChar].Level < 10) { SendData.sendMsgToPlayer(Attacker, lang.pvp_level_restriction, Globals.ColorRed, Globals.Msg_Type_Server); return(false); } if (!MapStruct.MapIsPVP(Map)) { SendData.sendMsgToPlayer(Attacker, lang.pvp_safe_zone, Globals.ColorRed, Globals.Msg_Type_Server); return(false); } } switch (Dir) { case 8: VictimY += 1; break; case 2: VictimY -= 1; break; case 4: VictimX += 1; break; case 6: VictimX -= 1; break; default: WinsockAsync.Log(String.Format("Direção nula")); return(false); } if ((VictimX == PlayerX) && (VictimY == PlayerY)) { return(true); } return(false); }
//********************************************************************************************* // CanThrowNpc / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Verifica se determinado NPC pode ser empurrado para determinada direção e distância //********************************************************************************************* public static bool canThrowNpc(int map, int s, byte Dir, int range) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, map, s, Dir, range) != null) { return(Convert.ToBoolean(Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, map, s, Dir, range))); } //CÓDIGO int x = NpcStruct.tempnpc[map, s].X; int y = NpcStruct.tempnpc[map, s].Y; //Tentamos nos mover switch (Dir) { case 8: if (y - range < 0) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].UpBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y - range].DownBlock) == false) { return(false); } if ((MapStruct.tile[map, x, y - range].Data1 == "3") || (MapStruct.tile[map, x, y - range].Data1 == "10") || (MapStruct.tile[map, x, y - range].Data1 == "2")) { return(false); } if ((MapStruct.tile[map, x, y - range].Data1 == "17") || (MapStruct.tile[map, x, y - range].Data1 == "18")) { return(false); } break; case 2: if (y + range > 14) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].DownBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y + range].UpBlock) == false) { return(false); } if ((MapStruct.tile[map, x, y + range].Data1 == "3") || (MapStruct.tile[map, x, y + range].Data1 == "10") || (MapStruct.tile[map, x, y + range].Data1 == "2")) { return(false); } if ((MapStruct.tile[map, x, y + range].Data1 == "17") || (MapStruct.tile[map, x, y + range].Data1 == "18")) { return(false); } break; case 4: if (x - range < 0) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].LeftBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x - range, y].RightBlock) == false) { return(false); } if ((MapStruct.tile[map, x - range, y].Data1 == "3") || (MapStruct.tile[map, x - range, y].Data1 == "10") || (MapStruct.tile[map, x - range, y].Data1 == "2")) { return(false); } if ((MapStruct.tile[map, x - range, y].Data1 == "17") || (MapStruct.tile[map, x - range, y].Data1 == "18")) { return(false); } break; case 6: if (x + range > 19) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].RightBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x + range, y].LeftBlock) == false) { return(false); } if ((MapStruct.tile[map, x + range, y].Data1 == "3") || (MapStruct.tile[map, x + range, y].Data1 == "10") || (MapStruct.tile[map, x + range, y].Data1 == "2")) { return(false); } if ((MapStruct.tile[map, x + range, y].Data1 == "17") || (MapStruct.tile[map, x + range, y].Data1 == "18")) { return(false); } break; default: WinsockAsync.Log(String.Format("Direção nula")); break; } return(true); }
//********************************************************************************************* // CanThrowPlayer / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Verifica se determinado pode ser empurrado em determinada direção e distância //********************************************************************************************* public static bool canThrowPlayer(int s, byte Dir, int range) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, s, Dir, range) != null) { return(Convert.ToBoolean(Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, s, Dir, range))); } //CÓDIGO int map = character[s, player[s].SelectedChar].Map; int x = character[s, player[s].SelectedChar].X; int y = character[s, player[s].SelectedChar].Y; //Tentamos nos mover switch (Dir) { case 8: if (y - range < 0) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].UpBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y - range].DownBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y - (range - 1)].UpBlock) == false) { return(false); } if ((MapStruct.tile[map, x, y - range].Data1 == "3") || (MapStruct.tile[map, x, y - range].Data1 == "10") || (MapStruct.tile[map, x, y - range].Data1 == "2")) { return(false); } if ((MapStruct.tile[map, x, y - range].Data1 == "17") || (MapStruct.tile[map, x, y - range].Data1 == "18")) { return(false); } if (MapStruct.tile[map, x, y - range].Data1 == "21") { if (!PlayerRelations.isPlayerPremmy(s)) { return(false); } } break; case 2: if (y + range > 14) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].DownBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y + range].UpBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y + (range - 1)].DownBlock) == false) { return(false); } if ((MapStruct.tile[map, x, y + range].Data1 == "3") || (MapStruct.tile[map, x, y + range].Data1 == "10") || (MapStruct.tile[map, x, y + range].Data1 == "2")) { return(false); } if ((MapStruct.tile[map, x, y + range].Data1 == "17") || (MapStruct.tile[map, x, y + range].Data1 == "18")) { return(false); } if (MapStruct.tile[map, x, y + range].Data1 == "21") { if (!PlayerRelations.isPlayerPremmy(s)) { return(false); } } break; case 4: if (x - range < 0) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].LeftBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x - range, y].RightBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x - (range - 1), y].LeftBlock) == false) { return(false); } if ((MapStruct.tile[map, x - range, y].Data1 == "3") || (MapStruct.tile[map, x - range, y].Data1 == "10") || (MapStruct.tile[map, x - range, y].Data1 == "2")) { return(false); } if ((MapStruct.tile[map, x - range, y].Data1 == "17") || (MapStruct.tile[map, x - range, y].Data1 == "18")) { return(false); } if (MapStruct.tile[map, x - range, y].Data1 == "21") { if (!PlayerRelations.isPlayerPremmy(s)) { return(false); } } break; case 6: if (x + range > 19) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].RightBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x + range, y].LeftBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x + (range - 1), y].RightBlock) == false) { return(false); } if ((MapStruct.tile[map, x + range, y].Data1 == "3") || (MapStruct.tile[map, x + range, y].Data1 == "10") || (MapStruct.tile[map, x + range, y].Data1 == "2")) { return(false); } if ((MapStruct.tile[map, x + range, y].Data1 == "17") || (MapStruct.tile[map, x + range, y].Data1 == "18")) { return(false); } if (MapStruct.tile[map, x + range, y].Data1 == "21") { if (!PlayerRelations.isPlayerPremmy(s)) { return(false); } } break; default: WinsockAsync.Log(String.Format("Direção nula")); break; } return(true); }
//********************************************************************************************* // CanPlayerMove / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon // Verifica se determinado jogador pode se mover no contexto em que está atualmente //********************************************************************************************* public static bool canPlayerMove(int s, byte Dir, int x = 0, int y = 0) { //EXTEND if (Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, s, Dir, x, y) != null) { return(Convert.ToBoolean(Extensions.ExtensionApp.extendMyApp (MethodBase.GetCurrentMethod().Name, s, Dir, x, y))); } //CÓDIGO int map = Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Map); if (x <= 0 || y <= 0) { x = Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].X); y = Convert.ToInt32(PlayerStruct.character[s, PlayerStruct.player[s].SelectedChar].Y); } //Tentamos nos mover switch (Dir) { case 8: if (y - 1 < 0) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].UpBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y - 1].DownBlock) == false) { return(false); } if ((MapStruct.tile[map, x, y - 1].Data1 == "3") || (MapStruct.tile[map, x, y - 1].Data1 == "10")) { return(false); } if (MapStruct.tile[map, x, y - 1].Data1 == "21") { if (!PlayerRelations.isPlayerPremmy(s)) { playerMove(s, Convert.ToByte(Convert.ToInt32(MapStruct.tile[map, x, y - 1].Data2))); return(false); } } break; case 2: if (y + 1 > 14) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].DownBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y + 1].UpBlock) == false) { return(false); } if ((MapStruct.tile[map, x, y + 1].Data1 == "3") || (MapStruct.tile[map, x, y + 1].Data1 == "10")) { return(false); } if (MapStruct.tile[map, x, y + 1].Data1 == "21") { if (!PlayerRelations.isPlayerPremmy(s)) { playerMove(s, Convert.ToByte(Convert.ToInt32(MapStruct.tile[map, x, y + 1].Data2))); return(false); } } break; case 4: if (x - 1 < 0) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].LeftBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x - 1, y].RightBlock) == false) { return(false); } if ((MapStruct.tile[map, x - 1, y].Data1 == "3") || (MapStruct.tile[map, x - 1, y].Data1 == "10")) { return(false); } if (MapStruct.tile[map, x - 1, y].Data1 == "21") { if (!PlayerRelations.isPlayerPremmy(s)) { playerMove(s, Convert.ToByte(Convert.ToInt32(MapStruct.tile[map, x - 1, y].Data2))); return(false); } } break; case 6: if (x + 1 > 19) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x, y].RightBlock) == false) { return(false); } if (Convert.ToBoolean(MapStruct.tile[map, x + 1, y].LeftBlock) == false) { return(false); } if ((MapStruct.tile[map, x + 1, y].Data1 == "3") || (MapStruct.tile[map, x + 1, y].Data1 == "10")) { return(false); } if (MapStruct.tile[map, x + 1, y].Data1 == "21") { if (!PlayerRelations.isPlayerPremmy(s)) { playerMove(s, Convert.ToByte(Convert.ToInt32(MapStruct.tile[map, x + 1, y].Data2))); return(false); } } break; default: WinsockAsync.Log(String.Format("Direção nula")); break; } return(true); }