public static StatePack ( int id, byte type1, byte type2, bool type3 ) : byte[] | ||
id | int | |
type1 | byte | |
type2 | byte | |
type3 | bool | |
return | byte[] |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Player Berserk Add /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Player_Berserk_Up() { try { if (!Character.Information.Berserking) { Character.Information.BerserkBar = 0; client.Send(Packet.InfoUpdate(4, 0, Character.Information.BerserkBar)); Character.Information.Berserking = true; if (Character.Information.Title != 0) { Character.Information.BerserkOran = 230; } else { Character.Information.BerserkOran = 200; } Send(Packet.StatePack(Character.Information.UniqueID, 4, 1, false)); //20.slot bersek speed slot Character.Speed.Updateded[20] = 100; Character.Speed.RunSpeed += Character.Speed.Updateded[20]; //Player_SetNewSpeed(); Send(Packet.SetSpeed(Character.Information.UniqueID, Character.Speed.WalkSpeed, Character.Speed.RunSpeed)); MsSQL.UpdateData("update character set berserkbar='" + Character.Information.BerserkBar + "' where id='" + Character.Information.CharacterID + "'"); StartBerserkerTimer(60000); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
//########################################################################################### // Normal return scrolls //########################################################################################### void HandleReturnScroll(int ItemID) { try { if (Character.Position.Walking) { return; } if (Character.Action.PickUping) { return; } if (Character.Stall.Stallactive) { return; } Send(Packet.StatePack(Character.Information.UniqueID, 0x0B, 0x01, false)); Character.Information.Scroll = true; StartScrollTimer(Data.ItemBase[ItemID].Use_Time); SavePlayerReturn(); } catch (Exception ex) { Systems.Debugger.Write(ex); } }
void GuildLeave() { //Write our function inside a catcher try { //Send required packets to network foreach (int member in Character.Network.Guild.Members) { //Make sure member s not null if (member != 0) { //Get information for the guildmember Systems guildmember = GetPlayerMainid(member); //Make sure the guildmember isnt null if (guildmember != null) { //Send update packet guildmember.client.Send(Packet.GuildUpdate(Character, 12, 0, 0, 0)); } } } //Send public packet to in range players (removal guild name). Send(Packet.GuildKick(Character.Information.UniqueID)); //Removal from guild client.Send(Packet.GuildLeave()); //Send normal state packet client.Send(Packet.StatePack(Character.Information.UniqueID, 0x04, 0x00, false)); //Count new members minus 1 int Membercount = Character.Network.Guild.Members.Count - 1; //Update database MsSQL.InsertData("UPDATE guild SET guild_members_t='" + Membercount + "' WHERE guild_name='" + Character.Network.Guild.Name + "'"); //Remove the player from database MsSQL.UpdateData("DELETE from guild_members where guild_member_id='" + Character.Information.CharacterID + "'"); //If the guild has a union if (Character.Network.Guild.UniqueUnion != 0) { //Set boolean unionactive to false Character.Network.Guild.UnionActive = false; //Remove the member from union member list Character.Network.Guild.UnionMembers.Remove(Character.Information.CharacterID); } //Cleanup character CleanUp(this); //Reload information LoadPlayerGuildInfo(true); } //Catch bad exception errors catch (Exception ex) { //Write information the the debug log Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Player Berserk Remove /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void Player_Berserk_Down() { try { Character.Information.Berserking = false; Character.Information.BerserkBar = 0; //Character.Speed.Updateded -= 100; //Player_SetNewSpeed(); Character.Speed.RunSpeed -= Character.Speed.Updateded[20]; Character.Speed.Updateded[20] = 0; Send(Packet.SetSpeed(Character.Information.UniqueID, Character.Speed.WalkSpeed, Character.Speed.RunSpeed)); Send(Packet.StatePack(Character.Information.UniqueID, 4, 0, false)); } catch (Exception ex) { Systems.Debugger.Write(ex); } }
void StopScrollTimer() { try { if (Timer.Scroll != null) { Timer.Scroll.Dispose(); } Timer.Scroll = null; Send(Packet.StatePack(Character.Information.UniqueID, 0x0B, 0x00, false)); Character.Information.Scroll = false; } catch (Exception ex) { Systems.Debugger.Write(ex); Console.WriteLine("stop scroll timer"); } }
void InGameSuccess() { //Wrap our function inside a catcher try { //If character isnt ingame yet if (!Character.InGame) { //Load player data PlayerDataLoad(); //Load premium ticket LoadTicket(Character); //Load guild information LoadPlayerGuildInfo(true); //Load spawns ObjectSpawnCheck(); //Send stats packet client.Send(Packet.PlayerStat(Character)); //Send player state packet client.Send(Packet.StatePack(Character.Information.UniqueID, 0x04, 0x02, false)); //Send complete load packet client.Send(Packet.Completeload()); //Send player silk packet client.Send(Packet.Silk(Player.Silk, Player.SilkPrem)); //Set new movement stopwatch Character.Position.Movementwatch = new System.Diagnostics.Stopwatch(); //Load friends GetFriendsList(); //Set player online MsSQL.UpdateData("UPDATE character SET online='1' WHERE id='" + Character.Information.CharacterID + "'"); //Set ingame bool to true this.Character.InGame = true; //Load message welcome (Copyright message leave intact). LoadMessage(); //Load guild data GetGuildData(); //Update hp and mp UpdateHp(); UpdateMp(); //Set player to normal state (4 0) / Not attackable = (4 2) client.Send(Packet.StatePack(Character.Information.UniqueID, 0x04, 0x00, false)); //Disabled until fully reworked and updated and optimized. //Load transport //LoadTransport(); //Load grabpet if active //LoadGrabPet(); //Regen this.HPregen(4000); this.MPregen(4000); } } //Catch bad exception errors catch (Exception ex) { //Write information to the console Console.WriteLine("InGame Success Error: {0}", ex); //Write error to debug log Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Berserk Items /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void HandleRegenZerk(int style, int ItemID) { try { if (Character.Information.Berserking) { return; } if (style == 1) { Character.Information.BerserkBar = 0; client.Send(Packet.InfoUpdate(4, 0, Character.Information.BerserkBar)); Character.Information.Berserking = true; if (Character.Information.Title != 0) { Character.Information.BerserkOran = 200; } else { Character.Information.BerserkOran = 200; } Send(Packet.StatePack(Character.Information.UniqueID, 4, 1, false)); Character.Speed.Updateded[20] = 150; Character.Speed.RunSpeed += Character.Speed.Updateded[20]; //Player_SetNewSpeed(); Send(Packet.SetSpeed(Character.Information.UniqueID, Character.Speed.WalkSpeed, Character.Speed.RunSpeed)); MsSQL.UpdateData("update character set berserkbar='" + Character.Information.BerserkBar + "' where id='" + Character.Information.CharacterID + "'"); StartBerserkerTimer(60000); string info2 = "You have 60 seconds until the scroll ends! Triple speed!"; client.Send(Packet.ChatPacket(7, Character.Information.UniqueID, info2, "")); } else if (style == 2) { Character.Information.BerserkBar = 0; client.Send(Packet.InfoUpdate(4, 0, Character.Information.BerserkBar)); Character.Information.Berserking = true; if (Character.Information.Title != 0) { Character.Information.BerserkOran = 200; } else { Character.Information.BerserkOran = 230; } Send(Packet.StatePack(Character.Information.UniqueID, 4, 2, false)); Character.Speed.Updateded[20] = 100; Character.Speed.RunSpeed += Character.Speed.Updateded[20]; Send(Packet.SetSpeed(Character.Information.UniqueID, Character.Speed.WalkSpeed, Character.Speed.RunSpeed)); MsSQL.UpdateData("update character set berserkbar='" + Character.Information.BerserkBar + "' where id='" + Character.Information.CharacterID + "'"); StartBerserkerTimer(100000); string info2 = "You have 100 seconds until the scroll ends!"; client.Send(Packet.ChatPacket(7, Character.Information.UniqueID, info2, "")); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
//########################################################################################### // Reverse scrolls //########################################################################################### void HandleReverse(int itemid, byte select, int objectlocationid) { try { //Remove loc // add loc to case 7 if (Character.Position.Walking) { StopMovementTimer(); } if (Character.Action.PickUping) { return; } if (Character.Stall.Stallactive) { return; } Character.Information.Scroll = true; StopTimers(); switch (select) { //Move to return point case 2: Send(Packet.StatePack(Character.Information.UniqueID, 0x0B, 0x01, false)); StartScrollTimer(1000); SavePlayerReturn(); break; //Move to last recall point case 3: MsSQL ms = new MsSQL("SELECT * FROM character_rev WHERE charname='" + Character.Information.Name + "'"); using (SqlDataReader reader = ms.Read()) { while (reader.Read()) { byte xSec = reader.GetByte(2); byte ySec = reader.GetByte(3); float x = reader.GetInt32(4); float z = reader.GetInt32(6); float y = reader.GetInt32(5); BuffAllClose(); DeSpawnMe(); ObjectDeSpawnCheck(); client.Send(Packet.TeleportOtherStart()); //Set state this.Character.InGame = false; Character.Position.xSec = xSec; Character.Position.ySec = ySec; Character.Position.x = x; Character.Position.z = z; Character.Position.y = y; client.Send(Packet.TeleportImage(xSec, ySec)); Character.Teleport = true; Timer.Scroll = null; Character.Information.Scroll = false; } } ms.Close(); break; //Teleport to map location case 7: BuffAllClose(); ObjectDeSpawnCheck(); DeSpawnMe(); client.Send(Packet.TeleportOtherStart()); Character.Position.xSec = Data.ReverseData[objectlocationid].xSec; Character.Position.ySec = Data.ReverseData[objectlocationid].ySec; Character.Position.x = (float)Data.ReverseData[objectlocationid].x; Character.Position.z = (float)Data.ReverseData[objectlocationid].z; Character.Position.y = (float)Data.ReverseData[objectlocationid].y; //Set state this.Character.InGame = false; client.Send(Packet.TeleportImage(Data.ReverseData[objectlocationid].xSec, Data.ReverseData[objectlocationid].ySec)); Character.Teleport = true; Timer.Scroll = null; Character.Information.Scroll = false; break; } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
///////////////////////////////////////////////////////////////////////// //Guild Disbanding ///////////////////////////////////////////////////////////////////////// #region Guild Disband void GuildDisband() { try { foreach (int member in Character.Network.Guild.Members) { if (member != 0) { Systems guildplayer = GetPlayerMainid(member); if (guildplayer != null) { if (guildplayer.Character.Information.CharacterID != Character.Information.CharacterID) { //Guild disband message packet guildplayer.client.Send(Packet.GuildUpdate(Character, 2, 0, 0, 0)); //Remove guild name and details from player Send(Packet.GuildKick(guildplayer.Character.Information.UniqueID)); //State packet guildplayer.client.Send(Packet.StatePack(guildplayer.Character.Information.UniqueID, 4, 0, false)); //Set all values to null. guildplayer.Character.Network.Guild.Members.Remove(guildplayer.Character.Information.CharacterID); guildplayer.Character.Network.Guild.MembersClient.Remove(guildplayer.client); guildplayer.Character.Network.Guild.Guildid = 0; if (guildplayer.Character.Network.Guild.UniqueUnion != 0) { guildplayer.Character.Network.Guild.UnionActive = false; guildplayer.Character.Network.Guild.UnionMembers.Remove(guildplayer.Character.Information.CharacterID); } } } } } //Guild disband message packet client.Send(Packet.GuildUpdate(Character, 2, 0, 0, 0)); //Remove guild name and details from player Send(Packet.GuildKick(Character.Information.UniqueID)); //State packet client.Send(Packet.StatePack(Character.Information.UniqueID, 4, 0, false)); //Set all values to null. //Remove all rows that contains guildname MsSQL.UpdateData("DELETE FROM guild_members WHERE guild_id=" + Character.Network.Guild.Guildid + ""); //Remove guild from guild table MsSQL.UpdateData("DELETE FROM guild WHERE id=" + Character.Network.Guild.Guildid + ""); //Remove ourself if (Character.Network.Guild.UniqueUnion != 0) { Character.Network.Guild.UnionActive = false; Character.Network.Guild.UnionMembers.Remove(Character.Information.CharacterID); } Character.Network.Guild.Members.Remove(Character.Information.UniqueID); Character.Network.Guild.MembersClient.Remove(client); Character.Network.Guild.Guildid = 0; //Packet Final message client.Send(Packet.PromoteOrDisband(1)); } catch (Exception ex) { Console.WriteLine("Guild Disband Error: {0}", ex); Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Player Death /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void Player_Up() { try { ///////////////////////////////////////////////////////////////////////////////////// // Normal Death / Return to return point ///////////////////////////////////////////////////////////////////////////////////// //Normal death if (Character.State.Die && Character.State.DeadType == 1) { if (Character.Information.Level <= 11) { //Check if character is walking should not be happening if (Character.Position.Walking) { return; } //Stop berserk timer if it were active StopBerserkTimer(); //Start sending packets for teleport client.Send(Packet.TeleportOtherStart()); //Reset state information Send(Packet.StatePack(this.Character.Information.UniqueID, 0, 1, false)); //Set the character hp to max hp / 2 this.Character.Stat.SecondHp = this.Character.Stat.Hp / 2; //this.Character.State.SafeState = true; //NotAttackableTimer(5000); this.UpdateHp(); //Send packet for updating hp client.Send(Packet.UpdatePlayer(this.Character.Information.UniqueID, 0x20, 1, this.Character.Stat.SecondHp)); //Set bool Character.State.Die = false; //Send state pack Send(Packet.StatePack(this.Character.Information.UniqueID, 4, 0, false)); } else { //Check if character is walking should not be happening if (Character.Position.Walking) { return; } //Save information for reverse scrolls SavePlayerReturn(); //Close buffs BuffAllClose(); //Set bool ingame Character.InGame = false; //Despawn DeSpawnMe(); //Despawn objects ObjectDeSpawnCheck(); //Send teleport packet client.Send(Packet.TeleportOtherStart()); //Update location Teleport_UpdateXYZ(Character.Information.Place); //Set hp to max hp / 2 this.Character.Stat.SecondHp = this.Character.Stat.Hp / 2; //Send teleport image client.Send(Packet.TeleportImage(Data.PointBase[Character.Information.Place].xSec, Data.PointBase[Character.Information.Place].ySec)); //Set bools Character.Teleport = true; Character.State.Die = false; } } else if (Character.State.Die && Character.State.DeadType == 2) { //Check if character is walking should not be happening if (Character.Position.Walking) { return; } //Stop berserk timer if it were active StopBerserkTimer(); //Start sending packets for teleport client.Send(Packet.TeleportOtherStart()); //Reset state information Send(Packet.StatePack(this.Character.Information.UniqueID, 0, 1, false)); //Set the character hp to max hp / 2 this.Character.Stat.SecondHp = this.Character.Stat.Hp / 2; //this.Character.State.SafeState = true; //NotAttackableTimer(5000); this.UpdateHp(); //Send packet for updating hp client.Send(Packet.UpdatePlayer(this.Character.Information.UniqueID, 0x20, 1, this.Character.Stat.SecondHp)); //Set bool Character.State.Die = false; //Send state pack Send(Packet.StatePack(this.Character.Information.UniqueID, 4, 0, false)); } else { Console.WriteLine("Unknown dead type: " + Character.State.DeadType + ""); } } catch (Exception ex) { Console.WriteLine("Death error {0}", ex); Systems.Debugger.Write(ex); } }