///////////////////////////////////////////////////////////////////////////////// // Item reinforce with stones ///////////////////////////////////////////////////////////////////////////////// public void AlchemyStoneMain() { try { PacketReader Reader = new PacketReader(PacketInformation.buffer); Character.Alchemy.ItemList = new List <Global.slotItem>(); byte type = Reader.Byte(); if (type == 1) { try { this.Character.Alchemy.AlchemyThread.Abort(); this.client.Send(Packet.AlchemyCancel()); } catch (Exception ex) { Systems.Debugger.Write(ex); } } else if (type == 2) { Reader.Skip(1); byte numitem = Reader.Byte(); this.Character.Alchemy.ItemList.Add(GetItem((uint)this.Character.Information.CharacterID, Reader.Byte(), 0)); this.Character.Alchemy.ItemList.Add(GetItem((uint)this.Character.Information.CharacterID, Reader.Byte(), 0)); } Alchemy = new Timer(new TimerCallback(StartAlchemyStoneResponse), 0, 3000, 0); } catch (Exception ex) { Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Exchange Request Check /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Request() { try { PacketReader Reader = new PacketReader(PacketInformation.buffer); if (Reader.Byte() == 1 && Reader.Byte() == 0) { Systems sys = GetPlayer(Character.Network.TargetID); sys.client.Send(Packet.Exchange_Cancel()); } else { Systems sys = GetPlayer(Character.Network.TargetID); sys.client.Send(Packet.OpenExhangeWindow(1, this.Character.Information.UniqueID)); client.Send(Packet.OpenExhangeWindow(sys.Character.Information.UniqueID)); Character.Network.Exchange.Window = true; Character.Network.Exchange.ItemList = new List <DarkEmu_GameServer.Global.slotItem>(); sys.Character.Network.Exchange.Window = true; sys.Character.Network.Exchange.ItemList = new List <DarkEmu_GameServer.Global.slotItem>(); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
void RenameParty() { try { //Create new packet reader PacketReader reader = new PacketReader(PacketInformation.buffer); //First integer is party id int partyid = reader.Int32(); //Second integer is not needed int NotNeeded = reader.Int32(); //Byte party type byte ptype = reader.Byte(); //Byte party purpose byte purpose = reader.Byte(); //Byte minimum level byte minlevel = reader.Byte(); //Byte max level to enter party byte maxlevel = reader.Byte(); //Party name lenght short namel = reader.Int16(); //Party name each character is a word value using text3 string pname = reader.Text3(); //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode to server packet Writer.Create(Systems.SERVER_PARTY_CHANGENAME); //Write static byte 1 Writer.Byte(1); //Write party id Writer.DWord(partyid); //Write dword 0 Writer.DWord(0); //Write party type Writer.Byte(ptype); //Write party purpose Writer.Byte(purpose); //Write party minimum level Writer.Byte(minlevel); //Write party max level Writer.Byte(maxlevel); //Write party name Writer.Text3(pname); //Send bytes to client client.Send(Writer.GetBytes()); } //If a error happens catch (Exception ex) { //Write the exception to the log Systems.Debugger.Write(ex); } }
///////////////////////////////////////////////////////////////////////////////// // Client connecting ///////////////////////////////////////////////////////////////////////////////// #region Client Connect public void Connect() { //Wrap our function inside a catcher try { //Open our packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); byte type = Reader.Byte(); Reader.Skip(3); string ID = Reader.Text(); string PW = Reader.Text(); Reader.Close(); //Set login result information int LoginResult = LoginUser(ID, ref PW, ref Player, true); //If the login is succesfull if (LoginResult == 0) { //Send succes packet client.Send(Packet.ConnectSuccess()); } //If the login is wrong else { //Disconnect the user client.Disconnect(PacketInformation.Client); } } catch (Exception ex) { Console.WriteLine("Client connect error {0}", ex); Systems.Debugger.Write(ex); } }
///////////////////////////////////////////////////////////////////////////////// // Open Npc ///////////////////////////////////////////////////////////////////////////////// protected void Open_NPC() { #region Open Npc try { Character.State.Busy = true; PacketReader Reader = new PacketReader(PacketInformation.buffer); Reader.UInt32(); byte type = Reader.Byte(); if (type == 1) { client.Send(Packet.OpenNPC(type)); } else { client.Send(Packet.OpenNPC(type)); } Reader.Close(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #endregion }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Join Job /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void JoinMerc() { try { MsSQL ms = new MsSQL("SELECT * FROM character_jobs WHERE character_name='" + Character.Information.Name + "'"); int checkjob = ms.Count(); if (checkjob == 0) { ///////////////////////////////////////////////////////////////////////////////////// PacketReader Reader = new PacketReader(PacketInformation.buffer); int id = Reader.Int32(); byte type = Reader.Byte(); ///////////////////////////////////////////////////////////////////////////////////// client.Send(Packet.InfoUpdate(1, Character.Information.CharacterID, 0)); client.Send(Packet.JoinMerchant(id, type)); ///////////////////////////////////////////////////////////////////////////////////// MsSQL.InsertData("INSERT INTO character_jobs (character_name, job_type) VALUES ('" + Character.Information.Name + "','2')"); ms.Close(); } else { // Not needed cant join job because excist } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Create Job Alias /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void MakeAlias() { try { /////////////////////////////////////////////////////////////////////////////////////////////////// PacketReader Reader = new PacketReader(PacketInformation.buffer); int id = Reader.Int32(); byte type = Reader.Byte(); short nLenght = Reader.Int16(); string name = Reader.String(nLenght); /////////////////////////////////////////////////////////////////////////////////////////////////// Console.WriteLine(name); MsSQL ms = new MsSQL("SELECT * FROM character_jobs WHERE job_alias='" + name + "'"); int checkjob = ms.Count(); /////////////////////////////////////////////////////////////////////////////////////////////////// client.Send(Packet.MakeAlias(name, type)); if (checkjob == 0) { client.Send(Packet.MakeAlias(name, type)); MsSQL.UpdateData("UPDATE character_jobs SET job_alias='" + name + "' WHERE character_name='" + Character.Information.Name + "'"); } else if (checkjob >= 0) { client.Send(Packet.MakeAliasError(name, type)); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
public static void PlayerQuickBar(PacketReader Reader, PacketWriter Writer) { byte amm = 0; int[] skillid = new int[51]; byte[] slotn = new byte[51]; for (byte i = 0; i <= 50; i++) { slotn[i] = Reader.Byte(); if (slotn[i] != 0) { skillid[i] = Reader.Int32(); amm++; } else Reader.Skip(4); } Writer.Byte(amm); for (byte i = 0; i <= 50; i++) { if (slotn[i] != 0) { Writer.Byte(i); Writer.Byte(slotn[i]); Writer.DWord(skillid[i]); } } Reader.Close(); }
public void CharacterScreen() { //Wrap our function inside a catcher try { //Open our packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); byte type = Reader.Byte(); //Switch on byte type switch (type) { case 1: //Character creation CharacterCreate(); break; case 2: //Character listening client.Send(CharacterListing(Player)); break; case 3: //Character deletion CharacterDelete(); break; case 4: //Character checking CharacterCheck(PacketInformation.buffer); break; case 5: //Character restoring CharacterRestore(); break; case 9: //Character job information CharacterJobInfo(); break; case 16: //Select job CharacterJobPick(PacketInformation.buffer); break; default: //We use this if we get a new case. Console.WriteLine("Character Screen Type: " + type); break; } //Close packet reader Reader.Close(); } catch (Exception ex) { Console.WriteLine("Characterscreen switch error {0}", ex); Systems.Debugger.Write(ex); } }
///////////////////////////////////////////////////////////////////////////////// // Friend add response ///////////////////////////////////////////////////////////////////////////////// void FriendAddResponse() { try { PacketReader reader = new PacketReader(PacketInformation.buffer); int Inviterid = reader.Int32(); int Myid = reader.Int32(); byte State = reader.Byte(); reader.Close(); Systems sys = GetPlayer(Inviterid); if (sys != null) { if (State == 0) { //Declined client.Send(Packet.FriendDecline(Character.Information.Name)); sys.client.Send(Packet.FriendDecline(Character.Information.Name)); } else { //Accepted sys.client.Send(Packet.FriendData(Myid, 2, Character.Information.Name, Character, false)); client.Send(Packet.FriendData(Inviterid, 2, sys.Character.Information.Name, sys.Character, false)); MsSQL.InsertData("INSERT INTO friends (owner,friend_name,model_info) VALUES ('" + Character.Information.CharacterID + "','" + sys.Character.Information.CharacterID + "','" + sys.Character.Information.Model + "')"); MsSQL.InsertData("INSERT INTO friends (owner,friend_name,model_info) VALUES ('" + sys.Character.Information.CharacterID + "','" + Character.Information.CharacterID + "','" + Character.Information.Model + "')"); } } } catch (Exception ex) { Console.WriteLine("Friend Add Response Error {0}", ex); Systems.Debugger.Write(ex); } }
void PrivateMessageOpen() { try { //Create new packet reader for reading packet information PacketReader Reader = new PacketReader(PacketInformation.buffer); //Create new packetwriter for writing our packet PacketWriter Writer = new PacketWriter(); //Read selected message id from packet byte SelectedMessageID = Reader.Byte(); //Close packet reader Reader.Close(); //Create new mssql query for getting the messages Systems.MsSQL ms = new Systems.MsSQL("SELECT * FROM message WHERE receiver='" + Character.Information.Name + "' ORDER BY time DESC"); //Create new integer for calculating what message must be selected. int Messageid = -1; //Create new sql data reader for reading column information using (SqlDataReader reader = ms.Read()) { //While our sql data reader is reading while (reader.Read()) { //Read message content string MessageContent = reader.GetString(3); //Increase our message id integer Messageid += 1; //Check if the messageid equals to our selected message if (Messageid == SelectedMessageID) { //Add opcode to packet Writer.Create(Systems.SERVER_PM_OPEN); //Write static byte Writer.Byte(1); //Write byte selected message id Writer.Byte(SelectedMessageID); //Write text message content Writer.Text(MessageContent); //Send packet to client client.Send(Writer.GetBytes()); //Update message state to read in database MsSQL.UpdateData("UPDATE message SET status='1' WHERE receiver='" + Character.Information.Name + "' AND message ='" + MessageContent + "'"); } } } //Close mssql ms.Close(); } //If an error accures we catch it here catch (Exception ex) { //Write information to the console Console.WriteLine("Error PrivateMessages.cs : {0}" + ex); //Write information to the debug logger Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////// // Grabpet settings /////////////////////////////////////////////////////////////////////////// void GrabPetSettings() { //Not worked on yet. PacketReader Reader = new PacketReader(PacketInformation.buffer); int petid = Reader.Int32(); byte type = Reader.Byte(); int settingsinfo = Reader.Int32(); client.Send(Packet.ChangePetSettings(1, petid, type, settingsinfo)); }
void PrivateMessageDelete() { try { //Create new packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); //Read message selected id byte SelectedMessageID = Reader.Byte(); //Close packet reader Reader.Close(); //Create new integer to get message id int Messageid = -1; //Create new mssql query MsSQL ms = new MsSQL("SELECT * FROM message WHERE receiver='" + Character.Information.Name + "' ORDER BY time DESC"); //Create new sql data reader for reading column information using (SqlDataReader reader = ms.Read()) { //While our sql data reader is reading while (reader.Read()) { //Read message content string MessageContent = reader.GetString(3); //Increase our message id integer Messageid += 1; //Check if the messageid equals to our selected message if (Messageid == SelectedMessageID) { //Create new packet writer PacketWriter Writer = new PacketWriter(); //Add opcode for deleting message Writer.Create(Systems.SERVER_PM_DELETE); //Write static byte 1 Writer.Byte(0x01); //Write byte selected message id Writer.Byte(SelectedMessageID); //Send packet to client client.Send(Writer.GetBytes()); //Update database MsSQL.DeleteData("DELETE FROM message WHERE message='" + reader.GetString(3) + "' AND receiver='" + Character.Information.CharacterID + "'"); } } } //Close mssql ms.Close(); } //If an error happens catch (Exception ex) { //Write information to the console Console.WriteLine("Delete private message error: " + ex); //Write info to debugger Systems.Debugger.Write(ex); } }
public static void PlayerAutoPot(PacketReader Reader, PacketWriter Writer) { Writer.Byte(Reader.Byte()); Writer.Byte(Reader.Byte()); Writer.Byte(Reader.Byte()); Writer.Byte(Reader.Byte()); Writer.Byte(Reader.Byte()); Writer.Byte(Reader.Byte()); Writer.Byte(Reader.Byte()); Reader.Close(); }
public void Gameguide()//Will need to read this byte by byte to get the id for the server to record for the chardata { try { PacketReader Reader = new PacketReader(PacketInformation.buffer); bool Guideok = false; int[] b1 = new int[8]; for (int b = 0; b < 8; ++b) //Reads Guide Data { b1[b] = Reader.Byte(); //Puts into a int Array } for (int gc = 0; gc < 8; ++gc)//This Checks The Last Send Guide Paket To Make Sure The Same Packet Is Not Read Twice { if (b1[gc] == Character.Guideinfo.Gchk[gc]) { Guideok = false;//If Guide Packet Has Been Sent Will Return False } else { Guideok = true;//If Guide Packet Is New Will Retun True And Break break; } } if (Guideok) { for (int gc = 0; gc < 8; ++gc) // Guide Packet Check { Character.Guideinfo.Gchk[gc] = b1[gc]; //Adds Packet To Int Array } for (int gi = 0; gi < 8; ++gi) //Guide Packet Update For Save And Teleport,Return,Etc { Character.Guideinfo.G1[gi] = Character.Guideinfo.G1[gi] + b1[gi]; //Adds The Packet And Updates The Data } PacketWriter Writer = new PacketWriter(); //Writes the Packet Responce For Guide Window Writer.Create(Systems.SERVER_SEND_GUIDE); Writer.Byte(1); for (int b = 0; b < 8; ++b) { Writer.Byte(b1[b]); } client.Send(Writer.GetBytes()); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Player Actions / Sit / Stand / Walk etc /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Doaction() { try { PacketReader Reader = new PacketReader(PacketInformation.buffer); List <int> toall = Character.Spawn; byte type = Reader.Byte(); switch (type) { case 2: if (Character.Transport.Right) { Send(toall, Packet.SetSpeed(Character.Transport.Horse.UniqueID, Character.Transport.Horse.Speed1, Character.Transport.Horse.Speed2)); Send(toall, Packet.ChangeStatus(Character.Transport.Horse.UniqueID, type, 0)); } Send(toall, Packet.ChangeStatus(Character.Information.UniqueID, type, 0)); break; case 3: if (Character.Transport.Right) { Send(toall, Packet.SetSpeed(Character.Transport.Horse.UniqueID, Character.Transport.Horse.Speed1, Character.Transport.Horse.Speed2)); Send(toall, Packet.ChangeStatus(Character.Transport.Horse.UniqueID, type, 0)); } Send(toall, Packet.ChangeStatus(Character.Information.UniqueID, type, 0)); break; case 4: if (!Character.Stall.Stallactive && !Character.Transport.Right && !Character.Position.Walking && !Character.State.Die) { StartSitTimer(1000); } else { //Needs Error Packet InStall } break; default: Send(toall, Packet.ChangeStatus(Character.Information.UniqueID, type, 0)); break; } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
//############################################################################## // Start timers voids //############################################################################## void StartPvpTimer(int time) { //Need to add checks PacketReader reader = new PacketReader(PacketInformation.buffer); byte pvptype = reader.Byte(); if (Timer.Pvp != null) { Timer.Pvp.Dispose(); } Timer.Pvp = new Timer(new TimerCallback(Player_Pvp_CallBack), 0, time, 0); Send(Packet.PvpSystemWait(Character.Information.UniqueID)); Character.Information.PvpWait = true; Character.Information.Pvptype = pvptype; }
void CharacterJobPick(byte[] buff) { //Wrap our function inside a catcher try { //Create new packet reader PacketReader Reader = new PacketReader(buff); //Skip first byte not used Reader.Skip(1); //Read name lenght short CharacterNameLEN = Reader.Int16(); //Read character name string CharacterName = Reader.String(CharacterNameLEN); //Read job selection byte job = Reader.Byte(); //Close packet reader Reader.Close(); //Get row count from character to check if the current account and character match int NameCheck = MsSQL.GetRowsCount("SELECT * FROM character WHERE account='" + Player.AccountName + "'"); //Get job information from database as integer int jobcheck = MsSQL.GetDataInt("SELECT jobtype FROM users WHERE id='" + Player.AccountName + "'", "jobtype"); //If the name check is succesfull and account has no job set. if (jobcheck == 0 && NameCheck != 0) { //Write new job information to the database MsSQL.UpdateData("UPDATE users SET jobtype='" + job + "' WHERE id='" + Player.AccountName + "'"); } //Send visual confirmation in packet PacketWriter writer = new PacketWriter(); //Add opcode writer.Create(Systems.SERVER_CHARACTERSCREEN); //Write static byte 10 writer.Byte(0x10); //Write succes byte 1 writer.Byte(1); //Send bytes to client client.Send(writer.GetBytes()); } //Catch any bad exception error catch (Exception ex) { //Write error information to the console Console.WriteLine("Job selection error {0}", ex); //Write error to debug log file Systems.Debugger.Write(ex); } }
void HandleRegisterIcon() { try { PacketReader reader = new PacketReader(PacketInformation.buffer); byte type = reader.Byte(); int iconlenght = reader.Int32(); string icon = reader.Text(); reader.Close(); string convertedicon = ConvertToHex(icon); //Save output to .dat file in hex formatting. } catch (Exception ex) { Console.WriteLine("Guild icon register error {0}", ex); } }
///////////////////////////////////////////////////////////////////////////////// // Save quick bar and autopotion ///////////////////////////////////////////////////////////////////////////////// #region Save quick bar & autopotion protected void Save() { //Wrap our function inside a catcher try { //Open our packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); string player_path; byte[] file; //Switch on byte switch (Reader.Byte()) { case 1: //Save quickbar information player_path = Environment.CurrentDirectory + @"\player\info\quickbar\" + Character.Information.Name + ".dat"; file = System.IO.File.ReadAllBytes(player_path); byte Slot = Reader.Byte(); byte sType = Reader.Byte(); Slot *= 5; file[Slot] = sType; file[Slot + 1] = Reader.Byte(); file[Slot + 2] = Reader.Byte(); file[Slot + 3] = Reader.Byte(); file[Slot + 4] = Reader.Byte(); System.IO.File.WriteAllBytes(player_path, file); break; case 2: //Save autopotion information player_path = Environment.CurrentDirectory + @"\player\info\autopot\" + Character.Information.Name + ".dat"; file = System.IO.File.ReadAllBytes(player_path); file[0] = Reader.Byte(); file[1] = Reader.Byte(); file[2] = Reader.Byte(); file[3] = Reader.Byte(); file[4] = Reader.Byte(); file[5] = Reader.Byte(); file[6] = Reader.Byte(); System.IO.File.WriteAllBytes(player_path, file); UpdateHp(); UpdateMp(); break; } Reader.Close(); } catch (Exception ex) { Console.WriteLine("Save quickbar and autopotion error {0}", ex); Systems.Debugger.Write(ex); } }
///////////////////////////////////////////////////////////////////////////////// // Item destruction with alchemy ///////////////////////////////////////////////////////////////////////////////// public void BreakItem() { try { //Checks before we continue if (Character.Stall.Stallactive || Character.Action.nAttack || Character.Action.sAttack || Character.Alchemy.working) { return; } //Set bool Character.Alchemy.working = true; //TODO: Timer for alchemy start / end PacketReader reader = new PacketReader(PacketInformation.buffer); byte rondorequired = reader.Byte(); byte slot = reader.Byte(); reader.Close(); //Get our item information (item) Global.slotItem item = GetItem((uint)Character.Information.CharacterID, slot, 0); //Get our degree information byte itemdegree = Data.ItemBase[item.ID].Degree; //First we get our elements (Same degree as weapon) //This should return 4 items //Add check rondo count if high enough. Character.Alchemy.Elementlist = GetDegreeElements(item.ID, Character); //Check if the item has any blues on it. if (Data.ItemBlue[item.dbID].totalblue != 0) { Character.Alchemy.StonesList = GetStonesDegree(item.ID, Character); } //Check current free slots of the player byte slotcheck = GetFreeSlot(); //If slot amount is lower then 4 return //Slots free must be 6 i believe because of stones (TODO: Check info official). if (slotcheck < 4) { //Send error message inventory full ... return; } //Player has enough slots so we continue adding the new items else { //Update rondo quantity Character.Information.InventorylistSlot = GetPlayerItems(Character); foreach (byte e in Character.Information.InventorylistSlot) { //Set slotitem Global.slotItem itemrondoinfo = GetItem((uint)Character.Information.CharacterID, e, 0); if (itemrondoinfo.ID != 0) { if (Data.ItemBase[itemrondoinfo.ID].Etctype == Global.item_database.EtcType.DESTROYER_RONDO) { //Update amount itemrondoinfo.Amount -= rondorequired; ItemUpdateAmount(itemrondoinfo, Character.Information.CharacterID); } } } //Clean our list Character.Information.InventorylistSlot.Clear(); //Remove the item used in dissembling (Query). MsSQL.DeleteData("DELETE FROM char_items WHERE id='" + item.dbID + "' AND owner='" + Character.Information.CharacterID + "'"); //Remove the item used in dissembling (Visual). ItemUpdateAmount(item, Character.Information.CharacterID); //Send packet #2 client.Send(Packet.DestroyItem()); //Repeat for each element in our list. foreach (int e in Character.Alchemy.Elementlist) { if (e != 0) { //TODO: Make detailed randoms //Make random add count for the elements //NOTE: Check what item has what element on destruction. if pk2 contains or not. int elementamount = 0; #region Amounts if (Data.ItemBase[item.ID].Degree == 1) { elementamount = rnd.Next(1, 60); } else if (Data.ItemBase[item.ID].Degree == 2) { elementamount = rnd.Next(1, 90); } else if (Data.ItemBase[item.ID].Degree == 3) { elementamount = rnd.Next(1, 120); } else if (Data.ItemBase[item.ID].Degree == 4) { elementamount = rnd.Next(1, 150); } else if (Data.ItemBase[item.ID].Degree == 5) { elementamount = rnd.Next(1, 200); } else if (Data.ItemBase[item.ID].Degree == 6) { elementamount = rnd.Next(1, 250); } else if (Data.ItemBase[item.ID].Degree == 7) { elementamount = rnd.Next(1, 300); } else if (Data.ItemBase[item.ID].Degree == 8) { elementamount = rnd.Next(1, 375); } else if (Data.ItemBase[item.ID].Degree == 9) { elementamount = rnd.Next(1, 450); } else if (Data.ItemBase[item.ID].Degree == 10) { elementamount = rnd.Next(1, 600); } else if (Data.ItemBase[item.ID].Degree == 11) { elementamount = rnd.Next(1, 800); } #endregion int stoneamount = 0; #region Stones if (Data.ItemBlue[item.dbID].totalblue != 0) { if (Data.ItemBlue[item.dbID].totalblue == 1) { stoneamount = rnd.Next(0, 1); } else if (Data.ItemBlue[item.dbID].totalblue == 2) { stoneamount = rnd.Next(0, 2); } } #endregion slotcheck = GetFreeSlot(); //Stack items todo AddItem(Data.ItemBase[e].ID, 10, slotcheck, Character.Information.CharacterID, 0); client.Send(Packet.GainElements(slotcheck, Data.ItemBase[e].ID, (short)elementamount)); } } //Clear created list content. Character.Alchemy.Elementlist.Clear(); } //Reset bool Character.Alchemy.working = false; } catch (Exception ex) { Console.WriteLine("Alchemy error destroyer {0}", ex); } }
//Void creation for characters void CharacterCreate() { //Start wrapper for catching errors try { //Check the amount of characters created (If 4 then we return). if (MsSQL.GetRowsCount("SELECT * FROM character WHERE account='" + Player.AccountName + "'") == 4) { return; } //Open our packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); //Need to be checked byte tocheck = Reader.Byte(); //String character name string NewCharacterName = Reader.Text(); //Integer for character model int NewCharacterModel = Reader.Int32(); //Byte for character volume byte NewCharacterVolume = Reader.Byte(); //Set new integer for item creation [4] total int[] Item = new int[4]; //Item id one integer Item[0] = Reader.Int32(); //Item id two integer Item[1] = Reader.Int32(); //Item id three integer Item[2] = Reader.Int32(); //Item id four integer Item[3] = Reader.Int32(); //Close packet reader Reader.Close(); //Set default character stats double MagicalDefense = 3; double PhysicalDefense = 6; double ParryRatio = 11; double HitRatio = 11; double MinimalPhysicalAttack = 6; double MaxPhysicalAttack = 9; double MinimalMagicalAttack = 6; double MaxMagicalAttack = 10; //Set mag defense MagicalDefense += Data.ItemBase[Item[0]].Defans.MinMagDef; MagicalDefense += Data.ItemBase[Item[1]].Defans.MinMagDef; MagicalDefense += Data.ItemBase[Item[2]].Defans.MinMagDef; //Set phy defence PhysicalDefense += Data.ItemBase[Item[0]].Defans.MinPhyDef; PhysicalDefense += Data.ItemBase[Item[1]].Defans.MinPhyDef; PhysicalDefense += Data.ItemBase[Item[2]].Defans.MinPhyDef; //Set parry information ParryRatio += Data.ItemBase[Item[0]].Defans.Parry; ParryRatio += Data.ItemBase[Item[1]].Defans.Parry; ParryRatio += Data.ItemBase[Item[2]].Defans.Parry; //Set hit ratio HitRatio += Data.ItemBase[Item[3]].Attack.MinAttackRating; //Set phy attack MinimalPhysicalAttack += Data.ItemBase[Item[3]].Attack.Min_LPhyAttack; MaxPhysicalAttack += Data.ItemBase[Item[3]].Attack.Min_HPhyAttack; //Set mag attack MinimalMagicalAttack += Data.ItemBase[Item[3]].Attack.Min_LMagAttack; MaxMagicalAttack += Data.ItemBase[Item[3]].Attack.Min_HMagAttack; //Set bool for european or chinese characters if (NewCharacterModel >= 14715 && NewCharacterModel <= 14745) { European = true; } //Replace any bad character from the name like [ , ] etc. NewCharacterName = Removebadchars(NewCharacterName); //Check the character name before creation if (CharacterCheck(NewCharacterName)) { //If bad send informational packet client.Send(Packet.CharacterName(4)); //Finally return. return; } //Random x y z output int random = rnd.Next(1, 3); //If player is creating a european character if (European) { //Set random start location for european if (random == 1) { randomx = 1030; randomz = 80; randomy = 512; } if (random == 2) { randomx = 889; randomz = 83; randomy = 1104; } if (random == 3) { randomx = 453; randomz = 80; randomy = 1249; } //Insert the basic information into the database MsSQL.InsertData("INSERT INTO character (account, name, chartype, volume, xsect, ysect, xpos, zpos, ypos, GuideData) VALUES ('" + Player.AccountName + "','" + NewCharacterName + "', '" + NewCharacterModel + "', '" + NewCharacterVolume + "','79','105','" + randomx + "','" + randomz + "','" + randomy + "','0000000000000000')"); //Insert reverse scroll data into the database MsSQL.InsertData("INSERT INTO character_rev (charname, revxsec, revysec, revx, revy, revz) VALUES ('" + NewCharacterName + "','79','105','" + randomx + "','" + randomy + "','" + randomz + "')"); //Set definition for the character id information Player.CreatingCharID = MsSQL.GetDataInt("Select * from character Where name='" + NewCharacterName + "'", "id"); //If the 3rd item is a sword or a dark staff if (Item[3] == 10730 || Item[3] == 10734) { //Add the mag def information MagicalDefense += Data.ItemBase[251].Defans.MinMagDef; //Add the phy def information PhysicalDefense += Data.ItemBase[251].Defans.MinPhyDef; //Add parry ration ParryRatio += Data.ItemBase[251].Defans.Parry; //Add shield item AddItem(10738, 0, 7, Player.CreatingCharID, 0); } //If the 3rd item is a crossbow if (Item[3] == 10733) { //We add our base bolts 250 AddItem(10376, 250, 7, Player.CreatingCharID, 0); } //Add base mastery's for europe characters AddMastery(513, Player.CreatingCharID); //Warrior AddMastery(515, Player.CreatingCharID); //Rogue AddMastery(514, Player.CreatingCharID); //Wizard AddMastery(516, Player.CreatingCharID); //Warlock AddMastery(517, Player.CreatingCharID); //Bard AddMastery(518, Player.CreatingCharID); //Cleric } //If the character model is an chinese character else { //Set random start location for chinese if (random == 1) { randomx = 1030; randomz = 80; randomy = 512; randomysec = 97; } if (random == 2) { randomx = 959; randomz = 20; randomy = 421; randomysec = 98; } if (random == 3) { randomx = 964; randomz = 0; randomy = 235; randomysec = 97; } //Add character default information into the database MsSQL.InsertData("INSERT INTO character (account, name, chartype, volume, xsect, ysect, xpos, zpos, ypos, GuideData) VALUES ('" + Player.AccountName + "','" + NewCharacterName + "', '" + NewCharacterModel + "', '" + NewCharacterVolume + "','168','" + randomysec + "','" + randomx + "','" + randomz + "','" + randomy + "','0000000000000000')"); //Add character reverse scroll information into the database MsSQL.InsertData("INSERT INTO character_rev (charname, revxsec, revysec, revx, revy, revz) VALUES ('" + NewCharacterName + "','168','" + randomysec + "','" + randomx + "','" + randomy + "','" + randomz + "')"); //Get new character id Player.CreatingCharID = MsSQL.GetDataInt("Select * from character Where name='" + NewCharacterName + "'", "id"); //If the item chosen is a blade or sword if (Item[3] == 3632 || Item[3] == 3633) { //Set magical defense for shield MagicalDefense += Data.ItemBase[251].Defans.MinMagDef; //Set physical defense for shield PhysicalDefense += Data.ItemBase[251].Defans.MinPhyDef; //Set parry ratio for shield ParryRatio += Data.ItemBase[251].Defans.Parry; //Add the shield to the character AddItem(251, 0, 7, Player.CreatingCharID, 0); } //If the item is a bow if (Item[3] == 3636) { //Add 250 arrows to the new character AddItem(62, 250, 7, Player.CreatingCharID, 0); } AddMastery(257, Player.CreatingCharID); //blade AddMastery(258, Player.CreatingCharID); //heuksal AddMastery(259, Player.CreatingCharID); //bow AddMastery(273, Player.CreatingCharID); //cold AddMastery(274, Player.CreatingCharID); //light AddMastery(275, Player.CreatingCharID); //fire AddMastery(276, Player.CreatingCharID); //force } //Add job mastery same for both races AddMastery(1000, Player.CreatingCharID); //Add the base items AddItem(Item[0], 0, 1, Player.CreatingCharID, 0); AddItem(Item[1], 0, 4, Player.CreatingCharID, 0); AddItem(Item[2], 0, 5, Player.CreatingCharID, 0); AddItem(Item[3], 0, 6, Player.CreatingCharID, 0); //Open settings information for start items ini = new Framework.Ini(Environment.CurrentDirectory + @"\Settings\Settings.ini"); try { //European start items custom string Item1 = ini.GetValue("European.Start", "Item1", "").ToString(); string Item2 = ini.GetValue("European.Start", "Item2", "").ToString(); string Item3 = ini.GetValue("European.Start", "Item3", "").ToString(); string Item4 = ini.GetValue("European.Start", "Item4", "").ToString(); string Item5 = ini.GetValue("European.Start", "Item5", "").ToString(); //Chinese start items cusom string Item6 = ini.GetValue("Chinese.Start", "Item1", "").ToString(); string Item7 = ini.GetValue("Chinese.Start", "Item2", "").ToString(); string Item8 = ini.GetValue("Chinese.Start", "Item3", "").ToString(); string Item9 = ini.GetValue("Chinese.Start", "Item4", "").ToString(); string Item10 = ini.GetValue("Chinese.Start", "Item5", "").ToString(); //The amount related information for european items custom string Amount1 = ini.GetValue("European.Start", "Amount1", "").ToString(); string Amount2 = ini.GetValue("European.Start", "Amount2", "").ToString(); string Amount3 = ini.GetValue("European.Start", "Amount3", "").ToString(); string Amount4 = ini.GetValue("European.Start", "Amount4", "").ToString(); string Amount5 = ini.GetValue("European.Start", "Amount5", "").ToString(); //The amount related information for chinese items custom string Amount6 = ini.GetValue("Chinese.Start", "Amount1", "").ToString(); string Amount7 = ini.GetValue("Chinese.Start", "Amount2", "").ToString(); string Amount8 = ini.GetValue("Chinese.Start", "Amount3", "").ToString(); string Amount9 = ini.GetValue("Chinese.Start", "Amount4", "").ToString(); string Amount10 = ini.GetValue("Chinese.Start", "Amount5", "").ToString(); //Add the custom items (European) AddItem(Convert.ToInt32(Item1), Convert.ToByte(Amount1), 13, Player.CreatingCharID, 0); AddItem(Convert.ToInt32(Item2), Convert.ToByte(Amount2), 14, Player.CreatingCharID, 0); AddItem(Convert.ToInt32(Item3), Convert.ToByte(Amount3), 15, Player.CreatingCharID, 0); AddItem(Convert.ToInt32(Item4), Convert.ToByte(Amount4), 16, Player.CreatingCharID, 0); AddItem(Convert.ToInt32(Item5), Convert.ToByte(Amount5), 17, Player.CreatingCharID, 0); //Add the custom items (Chinese) AddItem(Convert.ToInt32(Item6), Convert.ToByte(Amount1), 13, Player.CreatingCharID, 0); AddItem(Convert.ToInt32(Item7), Convert.ToByte(Amount2), 14, Player.CreatingCharID, 0); AddItem(Convert.ToInt32(Item8), Convert.ToByte(Amount3), 15, Player.CreatingCharID, 0); AddItem(Convert.ToInt32(Item9), Convert.ToByte(Amount4), 16, Player.CreatingCharID, 0); AddItem(Convert.ToInt32(Item10), Convert.ToByte(Amount5), 17, Player.CreatingCharID, 0); } catch (Exception) { } //Update database information for stats MsSQL.UpdateData("update character set min_phyatk='" + (int)Math.Round(MinimalPhysicalAttack) + "', max_phyatk='" + Math.Round(MaxPhysicalAttack) + "', min_magatk='" + Math.Round(MinimalMagicalAttack) + "', max_magatk='" + Math.Round(MaxMagicalAttack) + "', phydef='" + Math.Round(PhysicalDefense) + "', magdef='" + Math.Round(PhysicalDefense) + "', parry='" + Math.Round(ParryRatio) + "', hit='" + Math.Round(HitRatio) + "' where name='" + NewCharacterName + "'"); //Send information to the console Console.WriteLine("Character: " + NewCharacterName + " has been created"); //Send packet success to the client client.Send(Packet.ScreenSuccess(1)); } //If a error happens just catch it. catch (Exception ex) { Console.WriteLine(ex); } }
void Chat() { /* * We use for each now, to make sure there wont be any issues * Incase the list we send the packet to can have none connected clients. * To prevent bugging of chat we repeat and check each client before sending. */ try { //Set our list of ranged players List <int> Rangedplayers = Character.Spawn; //Create new packet reader for reading packet data PacketReader Reader = new PacketReader(PacketInformation.buffer); //Chat type byte (for our switch case). byte chatType = Reader.Byte(); //Byte chat index byte chatIndex = Reader.Byte(); //Link count byte byte linkCount = Reader.Byte(); //Create switch to switch on type of chat (normal party etc). switch (chatType) { //--------------------------------- [Normal chat] ---------------------------------// case 1: //Read written text from packet data string Text = Reader.Text3(); //Close packet reader Reader.Close(); // .additem 111 12 if (Character.Information.GM == 1 && Text[0] == '.') { gmCommands(Text); } //Repeat for each in range player foreach (int member in Rangedplayers) { //Make sure the member is not null if (member != 0) { //Make sure its not sending to our client if (member != Character.Information.UniqueID) { //Get member detail Systems memberinfo = GetPlayer(member); //Send packet to the in range player memberinfo.client.Send(Packet.ChatPacket(chatType, Character.Information.UniqueID, Text, null)); } } } //Send chatindex packet to ourselfs client.Send(Packet.ChatIndexPacket(chatType, chatIndex)); break; //--------------------------------- [Normal chat pink] ---------------------------------// case 3: //Check if our character has gm rights or not if (Character.Information.GM == 1) { //Read packet information (text typed). Text = Reader.Text3(); //Close packet reader Reader.Close(); //Repeat for each player in our range list foreach (int member in Rangedplayers) { //Check if the member is not null if (member != 0) { //Make sure its not sending to our own client if (member != Character.Information.UniqueID) { //Get member detail Systems memberinfo = GetPlayer(member); //Send packet to the member memberinfo.client.Send(Packet.ChatPacket(chatType, Character.Information.UniqueID, Text, null)); } } } //Send chat index to our client client.Send(Packet.ChatIndexPacket(chatType, chatIndex)); break; } //If character tried to use pink chat but isnt a gm else { //We ban the player for hacking attempt. Disconnect("ban"); } break; //--------------------------------- [Private chat] ---------------------------------// case 2: //Read from packet data who we are sending the message to string Target = Reader.Text(); //Get information from the given player we send to Systems Targetplayer = GetPlayerName(Target); //Make sure the player sending to is not null if (Targetplayer != null) { //Make sure the player is ingame (Not teleporting or such). if (Targetplayer.Character.InGame) { //Read the message from the packet data Text = Reader.Text3(); //Close the packet reader Reader.Close(); //Send packet to our target Targetplayer.client.Send(Packet.ChatPacket(chatType, 0, Text, this.Character.Information.Name)); //Send chatindex packet to ourselfs client.Send(Packet.ChatIndexPacket(chatType, chatIndex)); } } break; //--------------------------------- [Party chat] ---------------------------------// case 4: //Make sure the player is in a party if (Character.Network.Party != null) { //Read the text the player has typed from packet data Text = Reader.Text3(); //Close packet reader Reader.Close(); //Repeat for each member in the party member list foreach (int member in Character.Network.Party.Members) { //Make sure the member isnt null (0) if (member != 0) { //Get detailed info for the player Systems memberinfo = GetPlayer(member); //Send packet information to the member for chat memberinfo.client.Send(Packet.ChatPacket(chatType, Character.Information.UniqueID, Text, this.Character.Information.Name)); } } //Finally send chatindex packet to ourselfs client.Send(Packet.ChatIndexPacket(chatType, chatIndex)); } break; //--------------------------------- [Guild chat] ---------------------------------// case 5: //Read message beeing send from packet data Text = Reader.Text3(); //Close packet reader Reader.Close(); //Repeat for each member in the guild member list foreach (int member in Character.Network.Guild.Members) { //Make sure the member is not null (0) if (member != 0) { //Get guild member detailed information Systems Guildmember = GetPlayerMainid(member); //Again check if the guild member is not null if (Guildmember != null) { //Send chat packet to the member Guildmember.client.Send(Packet.ChatPacket(chatType, Character.Information.UniqueID, Text, this.Character.Information.Name)); } } } //Send chat index packet to our client client.Send(Packet.ChatIndexPacket(chatType, chatIndex)); break; //--------------------------------- [Global chat] ---------------------------------// case 6: //Get sender name from packet data string Sender = Reader.Text(); //Get message from packet data Text = Reader.Text3(); //Send to every client connected and logged in SendAll(Packet.ChatPacket(chatType, Character.Information.UniqueID, " " + Text, Sender)); break; //--------------------------------- [Notice chat] ---------------------------------// case 7: //Make sure the character sending is a gm if (Character.Information.GM == 1) { //Get message from packet data Text = Reader.Text3(); //Close packet reader Reader.Close(); //Send to everyone ingame (using void sendnoticecon). SendAll(sendnoticecon(chatType, Character.Information.UniqueID, Text, null)); } //If the character is not a gm else { //Disconnect and ban the player for hack attempt Disconnect("ban"); } break; //--------------------------------- [Stall chat] ---------------------------------// case 9: //Read message from packet data Text = Reader.Text3(); //Close packet reader Reader.Close(); //Repeat for each member in the stall foreach (int stallmember in Character.Network.Stall.Members) { //Make sure the stall member isnt null 0 if (stallmember != 0) { //Get stall member details Systems member = GetPlayer(stallmember); //Make sure the member isnt null if (member != null) { //Send chat packet to the member member.client.Send(Packet.ChatPacket(chatType, Character.Network.Stall.ownerID, Text, this.Character.Information.Name)); } } } //Send chat index to ourselfs client.Send(Packet.ChatIndexPacket(chatType, chatIndex)); break; //--------------------------------- [Academy chat] ---------------------------------// case 10: //Todo academy system then chat. break; //--------------------------------- [Union chat] ---------------------------------// case 11: //Read message from packet data Text = Reader.Text3(); //Close packet reader Reader.Close(); //If the character has no union if (!Character.Network.Guild.UnionActive) { //Return return; } //Else for each member in the union foreach (int member in Character.Network.Guild.UnionMembers) { //Make sure the union member is not null 0 if (member != 0) { //Get member detailed information Systems tomember = GetPlayerMainid(member); //Make sure the member is not null if (tomember != null) { //Make sure the member isnt ourself if (tomember.Character.Information.CharacterID != Character.Information.CharacterID) { //Send packet to the union member tomember.client.Send(Packet.ChatPacket(chatType, Character.Information.UniqueID, Text, Character.Information.Name)); } } } } //Repeat for each member in the guild foreach (int member in Character.Network.Guild.Members) { //Make sure the member isnt null 0 if (member != 0) { //Get member detailed information Systems tomember = GetPlayerMainid(member); //Make sure the member isnt null if (tomember != null) { //Make sure the member isnt ourself if (tomember.Character.Information.CharacterID != Character.Information.CharacterID) { //Send packet to the member tomember.Character.Network.Guild.SingleSend = false; } } } } //Finally send chat index packet to ourself client.Send(Packet.ChatIndexPacket(chatType, chatIndex)); break; } } //If an exception error happens catch (Exception errorinformation) { //Write the information to the console Console.WriteLine("Chat error {0}", errorinformation); //Write the information to the log system Systems.Debugger.Write(errorinformation); } }
public void StallMain() { try { PacketReader Reader = new PacketReader(PacketInformation.buffer); byte Type = Reader.Byte(); //Item edit if (Type == 1) { if (Character.Network.Stall.isOpened) { return; } byte stallslot = Reader.Byte(); Reader.Skip(2); ulong price = Reader.UInt64(); if (price <= 999999999) { int StallItemIndex = Character.Network.Stall.ItemList.FindIndex(i => (i.stallSlot == stallslot)); Character.Network.Stall.ItemList[StallItemIndex].price = price; Character.Network.Stall.Send(Packet.StallModifyItem(stallslot, price)); } else { return; } } //Add an item else if (Type == 2) { if (Character.Network.Stall.isOpened) { return; } byte stallslot = Reader.Byte(); byte invpos = Reader.Byte(); short quantity = Reader.Int16(); ulong price = Reader.UInt64(); Global.slotItem uItemID = GetItem((uint)Character.Information.CharacterID, invpos, 0); //Disable item mall items in stalls for now. if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.GLOBALCHAT || Data.ItemBase[uItemID.ID].Type == Global.item_database.ArmorType.AVATAR || Data.ItemBase[uItemID.ID].Type == Global.item_database.ArmorType.AVATARHAT || Data.ItemBase[uItemID.ID].Type == Global.item_database.ArmorType.AVATARATTACH ) { return; } if (quantity <= Data.ItemBase[uItemID.ID].Max_Stack) { stall.stallItem StallItem = new stall.stallItem(); LoadBluesid(uItemID.dbID); StallItem.stallSlot = stallslot; StallItem.price = price; StallItem.Item = (GetItem((uint)Character.Information.CharacterID, invpos, 0)); if (Character.Network.Stall.ItemList.Exists((get => get.Item.dbID == StallItem.Item.dbID))) { return; } Character.Network.Stall.ItemList.Add(StallItem); Character.Network.Stall.Send(Packet.StallItemMain(Character.Network.Stall.ItemList)); } else { return; } } //Item pulling out else if (Type == 3) { if (Character.Network.Stall.isOpened) { return; } byte stallslot = Reader.Byte(); //remove stallItem from stall Character.Network.Stall.ItemList.Remove(Character.Network.Stall.ItemList.Find(i => (i.stallSlot == stallslot))); Character.Network.Stall.Send(Packet.StallItemMain(Character.Network.Stall.ItemList)); } //Stall modify state else if (Type == 5) { byte State = Reader.Byte(); Character.Network.Stall.isOpened = (State == 1) ? true : false; Character.Network.Stall.Send(Packet.StallSetState(State)); } //Set Welcome msg else if (Type == 6) { if (Character.Network.Stall.isOpened) { return; } short length = Reader.Int16(); Character.Network.Stall.WelcomeMsg = Reader.Text3(); //Console.WriteLine("New Welcome msg:" + welcome); Character.Network.Stall.Send(Packet.StallWelcome(Character.Network.Stall.WelcomeMsg)); } //Set StallName else if (Type == 7) { string stallname = Reader.Text3(); Send(Packet.StallNameGlobal(Character.Information.UniqueID, stallname)); Character.Network.Stall.Send(Packet.StallName(stallname)); } } catch (Exception ex) { Console.WriteLine("Additem Stall error: {0}", ex); } }
public void RequestIcons() { PacketReader Reader = new PacketReader(PacketInformation.buffer); byte IconType = Reader.Byte(); short IconHexLenght = Reader.Int16(); string Icon = Reader.String(IconHexLenght); Reader.Close(); //Need to figure out the string.. identification of the icon probably client.Send(Packet.IconSend(IconType, Icon)); // Below is sniffed data /* * [S -> C][2114] * 01 Byte = Type icon (1 = Guild 2 = union). * 1C 01 Lenght of hex icon string * * // below is the hex string (Ascii) icon * 74 6D 28 73 81 2A 47 37 F6 13 99 62 8C 3F 4E 29 tm(s.*G7...b.?N) * 0F 04 CB 3D E6 5F FC 0B D6 07 03 DD 0D 72 9A 25 ...=._.......r.% * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * 8A 88 BF CB 59 5A 8A 08 74 80 32 53 AA 1C 5E 86 ....YZ..t.2S..^. * FE DC BA 98 76 54 32 10 0F 1E 2D 3C ....vT2...-<.... * * [C -> S][2114] * 02 ................ * 0C 00 ................ * AE A5 BF 3C 23 65 0C 01 03 1E 27 3C ...<#e....'<.... */ /* * (Nukei)Discovered so far: * client requests image by contacting 121.128.134.16 (gdmark.joymax.com) using HTTP protocol over port 15080 * like: * http://gdmark.joymax.com:15080/SRO_CREST/A96_2132_1.crb (this files is saved in sro-client's RD folder as A96_2132.rd converted to BMP format) * * the returned header indicates, that the returned content is 256 Bytes in size (16 x 16 = 256). the given type is "application". * * ToDo: * 1. Why or when the client starts this request for images ? * 2. Is the returned array of bytes 16x16 palette entries ? * 3. if 2 is right, what palette is used ? * * Result: * 1. dont know :-P * 2. Yes, we get a paletted image in 16x16 size (without palette, without size, RAW pixel), so every byte is one pixel. pay attention that the Y coordinates are reversed, so the image is bottom up. * 3. discovered that it is the windows system palette !! * * I dont know if the image really is transfered with 2114 packet !!! * * Tools used: PhotoShop, Wireshark, WinHex */ /*Xsense: * Result: * 1. I believe send on guild name spawn by 1 byte indication active non active. * 1. Simple check would be a bool from database on creation of icon set to true, * 1. Deletion item / guild disband / union kick / leave would remove the bool information from db. * 2. Indexed color 8 bit setting. (Change extension to bmp / checked photoshop indications). * 3. * 4. RD should be cache folder, which server could check from registry path to see excisting icons. */ /* * (Rokky93) Discovered: * * I search a bit about CREST System of Joymax and found an interesting blog.So now i will tell you my results: * * 1. Silkroad stores Guild Icons on a stand-alone FTP Server. You can find them in the Media.pk2/type.txt * 2. For example A96_2132_1.crb: * A - type(Guild or Alliance) * 96- Server ID * 2132 - guild id * 1 - crest id * * When we want to convert it to bmp: * 1. Silkroad uses 16x16 pixel big 8bbp bitmaps with static color palette and no compression. The stored crests are 256B big. * 2. BMP Structure: * header - static * meta - static * palette - static * bitmap (crest file content) - dynamic * * When we want to send icons to Client * 1. We have to change the FTP Server in the Media.pk2 * 2. We must send this packet to Client * byte - type(alliance, guild) 00 or 01 * dword - guildid * string - guildname * dword - crestindex * * For example: * type G * serverId 187 * guildId 2929 * crestid 3 * * Client makes this : G187_2929_3.crb and download them from server ( this is my theory) * * * GET /SRO_CREST/A239_282_3.crb HTTP/1.1 * Accept-Encoding: gzip, deflate * User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E) * Host: gdmark.joymax.com:15080 * Connection: Keep-Alive */ }
public void StallBuy() { try { if (!Character.Network.Stall.isOpened) { return; } PacketReader Reader = new PacketReader(PacketInformation.buffer); byte stallslot = Reader.Byte(); stall currentStall = Character.Network.Stall; stall.stallItem sitem = currentStall.ItemList.Find(i => (i.stallSlot == stallslot)); // stall buyer update byte slot = GetFreeSlot(); if (slot <= 12) { return; } if (Character.Information.Gold >= (long)sitem.price) { Character.Information.Gold -= (long)sitem.price; client.Send(Packet.UpdateGold(Character.Information.Gold)); SaveGold(); } else { return; //insufficent gold } // staller update if (currentStall.ItemList.Contains(sitem)) { Systems staller = GetPlayer(currentStall.ownerID); staller.Character.Information.Gold += (long)sitem.price; staller.client.Send(Packet.UpdateGold(staller.Character.Information.Gold)); MsSQL.UpdateData("update character set gold='" + staller.Character.Information.Gold + "' where id='" + staller.Character.Information.CharacterID + "'"); //MsSQL.UpdateData("delete from char_items where itemnumber='item" + sitem.Item.Slot + "' AND owner='" + staller.Character.Information.CharacterID + "'"); Systems.MsSQL.InsertData("UPDATE char_items SET owner='" + Character.Information.CharacterID + "',slot='" + slot + "',itemnumber='item" + slot + "' WHERE owner='" + staller.Character.Information.CharacterID + "' AND itemid='" + sitem.Item.ID + "' AND id='" + sitem.Item.dbID + "' AND storagetype='0'"); //take item out from stall if (currentStall.ItemList.Count == 1) { staller.Character.Stall.Stallactive = false; Character.Stall.Stallactive = false; } currentStall.ItemList.Remove(sitem); client.Send(Packet.StallBuyItem(stallslot, 1)); currentStall.Send(Packet.StallBuyItem2(Character.Information.Name, stallslot, currentStall.ItemList)); } else { Disconnect("ban"); Console.WriteLine("Autobanned user: "******" Due to hacking"); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
void Handle() { try { //Read packet information PacketReader Reader = new PacketReader(PacketInformation.buffer); byte iSlot = Reader.Byte(); //Get global item information Global.slotItem uItemID = GetItem((uint)Character.Information.CharacterID, iSlot, 0); //Checks before continuing if (uItemID.ID != 0 || !Character.State.Die) { //########################################################################################### // Grabpets //########################################################################################### #region Pets (PET OBJECTS) // Grabpets #region Grabpets if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.GRABPET) { //Check if we have pet active allready. if (!Character.Grabpet.Active && Character.Action.MonsterID.Count == 0) { //If not active , add new pet object. HandleGrabPet(iSlot, uItemID.ID); //Need to change this to active effect on slot. HandleUpdateSlotn(iSlot, uItemID, Reader.Int32()); } } #endregion // Attackpets #region Attackpets else if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.ATTACKPET) { //Check if we have pet active allready. if (!Character.Attackpet.Active && Character.Action.MonsterID.Count == 0 || !Character.Attackpet.Active && Character.Action.MonsterID == null) { //If not active , add new pet object. if (!Character.Attackpet.Active) { HandleUpdateSlotn(iSlot, uItemID, Reader.Int32()); HandleAttackPet(iSlot, uItemID.ID); client.Send(Packet.Update2(iSlot)); client.Send(Packet.ChangeStatus(Character.Information.UniqueID, 5, 0)); } } } #endregion #endregion // Horses (NOTE: Detail error messages per if statement (if level, summoned etc). #region Horses if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.TRANSPORT) { //Checks before we continue if (!Character.Stall.Stallactive && !Character.Transport.Right && Character.Action.MonsterID.Count == 0 && !Character.State.Sitting && !Character.Information.Scroll) { //Check if level is high enough if (this.Character.Information.Level >= Data.ItemBase[uItemID.ID].Level) { HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); HandleHorseScroll(uItemID.ID); } //Else else { client.Send(Packet.IngameMessages(SERVER_PLAYER_UPTOHORSE, IngameMessages.UIIT_MSG_COSPETERR_CANT_PETSUM_HIGHLEVEL)); } } } #endregion // Special transport #region Special transport else if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.ATTACKPET) { } #endregion // Job Transport #region Job Transport else if (Data.ItemBase[uItemID.ID].Pettype == Global.item_database.PetType.JOBTRANSPORT) { //HandleJobTransport(uItemID.ID); } #endregion //########################################################################################### // Potions //########################################################################################### #region Potions #region HP potion if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.HP_POTION && Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.HPSTATPOTION) { HandlePotion(1, uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } else if (Data.ItemBase[uItemID.ID].Name.Contains("_HP_") && Data.ItemBase[uItemID.ID].Name.Contains("_SUPERSET_")) { HandlePotion(1, uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion #region HP STAT Potions else if (Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.HP_POTION && Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.HPSTATPOTION) { } #endregion #region MP potions else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.MP_POTION && Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.MPSTATPOTION) { HandlePotion(2, uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } else if (Data.ItemBase[uItemID.ID].Name.Contains("_MP_") && Data.ItemBase[uItemID.ID].Name.Contains("_SUPERSET_")) { HandlePotion(1, uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion #region HP STAT Potions else if (Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.HP_POTION && Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.MPSTATPOTION) { } #endregion #region Vigor potions /* * else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.VIGOR_POTION) * { * HandlePotion(5, uItemID.ID); * HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); * } */ else if (Data.ItemBase[uItemID.ID].Name.Contains("ITEM_ETC_ALL_")) { HandlePotion(5, uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion #region Speed potions else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.SPEED_POTION) { if (Character.Speed.DefaultSpeed == Character.Speed.RunSpeed || Character.Speed.DefaultSpeed + Character.Speed.Updateded[20] != Character.Speed.RunSpeed && Character.Information.Berserking) { this.SpecialBuff(Data.ItemBase[uItemID.ID].SkillID); HandleUpdateSlot(iSlot, uItemID, Reader.UInt16()); } } #endregion #region Berserk Potion else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.BERSERKPOTION) { if (Character.Information.BerserkBar < 5) { if (Character.Information.Berserking == false) { this.Character.Information.BerserkBar = 5; client.Send(Packet.InfoUpdate(4, 0, Character.Information.BerserkBar)); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } } } #endregion #endregion //########################################################################################### // Tickets //########################################################################################### #region Tickets //Forgotten world #region Forgotten world else if (Data.ItemBase[uItemID.ID].Ticket == Global.item_database.Tickets.DUNGEON_FORGOTTEN_WORLD) { //Must add check if user location currently is forgotten world. //Must add level check of portal. ForgottenWorld(uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion #endregion //########################################################################################### // Global chat //########################################################################################### #region Global Chat else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.GLOBALCHAT) { HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); byte something = Reader.Byte(); string text = Reader.Text3(); Reader.Close(); SendAll(Packet.ChatPacket(6, 0, text, Character.Information.Name)); } #endregion //########################################################################################### // Stall decoration //########################################################################################### #region Stall decoration else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.STALLDECORATION) { StallDeco(uItemID.ID, iSlot); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion //########################################################################################### // Monster masks //########################################################################################### #region Monster masks else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.MONSTERMASK) { //If character monster mask isnt enabled allready. if (!Character.Transformed) { if (Character.Information.Level >= Data.ItemBase[uItemID.ID].Level) { //Load Mask MonsterMasks(uItemID.ID, iSlot); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } else { //Send msg level to low } } else { //Send msg allready in use } } #endregion //########################################################################################### // Return scrolls //########################################################################################### #region Return scrolls else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.RETURNSCROLL && Data.ItemBase[uItemID.ID].Etctype != Global.item_database.EtcType.REVERSESCROLL) { if (Character.Information.Scroll) { return; } if (Timer.Movement != null) { Timer.Movement.Dispose(); Character.Position.Walking = false; } HandleReturnScroll(uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion //########################################################################################### // Reverse scrolls //########################################################################################### #region Reverse scrolls else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.REVERSESCROLL) { if (Character.Information.Scroll) { return; } if (Character.Position.Walking) { return; } //Read item id int itemid = Reader.Int32(); //Our switch byte byte type = Reader.Byte(); //locations for reverse int locid = 0; if (type == 7) { locid = Reader.Int32(); } //Start our handle HandleReverse(itemid, type, locid); //Update slot HandleUpdateSlot(iSlot, uItemID, itemid); } #endregion //########################################################################################### // Thief scrolls //########################################################################################### #region Thief scrolls else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.BANDITSCROLL) { if (Character.Information.Scroll) { return; } HandleThiefScroll(uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion //########################################################################################### // Summon scrolls //########################################################################################### #region Summon scrolls else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.SUMMONSCROLL) { HandleSummon(Character.Information.Level); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion //########################################################################################### // Skin change scrolls //########################################################################################### #region Skin change scrolls else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.CHANGESKIN) { HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); int skinmodel = Reader.Int32(); HandleSkinScroll(skinmodel, uItemID.ID); } #endregion //########################################################################################### // Item change tool //########################################################################################### #region Skin change scrolls else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.ITEMCHANGETOOL) { int itemid = Reader.Int32(); byte targetslot = Reader.Byte(); //Make sure the item target is not equiped. if (targetslot < 13) { return; } //Continue HandleUpdateSlot(iSlot, uItemID, itemid); HandleItemChange(uItemID.ID, iSlot, targetslot); } #endregion //########################################################################################### // Dungeon items //########################################################################################### #region Forgotten world else if (Data.ItemBase[uItemID.ID].Ticket == Global.item_database.Tickets.DUNGEON_FORGOTTEN_WORLD) { HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); ForgottenWorld(uItemID.ID); } #endregion //########################################################################################### // Inventory expansion //########################################################################################### #region Inventory expansion else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.INVENTORYEXPANSION) { HandleInventoryExp(uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion //########################################################################################### // Warehouse expansion //########################################################################################### #region Warehouse expansion else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.WAREHOUSE) { HandleWareHouse(uItemID.ID); HandleUpdateSlot(iSlot, uItemID, Reader.Int32()); } #endregion //########################################################################################### // Guild related //########################################################################################### #region Guild Icon else if (Data.ItemBase[uItemID.ID].Etctype == Global.item_database.EtcType.GUILD_ICON) { HandleRegisterIcon(); } #endregion //########################################################################################### // Non coded types //########################################################################################### else { //Need to make message in progress or such Console.WriteLine("Non Coded Item ID: " + Data.ItemBase[uItemID.ID].ID + " Name: " + Data.ItemBase[uItemID.ID].Name + ""); } } // Close our packet reader Reader.Close(); } catch (Exception ex) { Console.WriteLine("Item usage error {0}", ex); Systems.Debugger.Write(ex); } }
void ActionMain() { try { if (Character.State.Die || Character.Information.Scroll || Character.Action.Cast) { return; } //Create new packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); //Read main action type byte type = Reader.Byte(); //If attack action byte is not equal to 2 if (type != 2) { //Read player action byte byte PlayerAction = Reader.Byte(); //Create switch on player actions switch (PlayerAction) { //Normal attacking case 1: //If character is allready using normal attack if (Character.Action.nAttack) { //Return return; } //If the character is riding a horse if (Character.Transport.Right) { //Return, because character cannot attack while riding a horse. return; } //If the character is picking up a item if (Character.Action.PickUping) { //Stop pick up timer StopPickUpTimer(); } //Skip non needed byte Reader.Skip(1); //Read integer target id (DWORD). int TargetID = Reader.Int32(); //Close packet reader Reader.Close(); //Set target id for usage later in attacking. Character.Action.Object = GetObjects(TargetID); //Set bool normal attack to true Character.Action.nAttack = true; //Set character target id Character.Action.Target = TargetID; //Start attacking StartAttackTimer(1425); break; case 2: //pickup if (Character.Action.nAttack) { return; } if (Character.Action.sAttack) { return; } if (Character.Action.sCasting) { return; } if (Character.Action.PickUping) { return; } Reader.Byte(); int id2 = Reader.Int32(); Reader.Close(); Character.Action.Target = id2; Character.Action.PickUping = true; StartPickupTimer(600); break; case 3: //trace if (Character.Action.sAttack) { return; } if (Character.Action.sCasting) { return; } if (Character.State.Sitting) { return; } if (Character.Stall.Stallactive) { return; } Reader.Byte(); int id3 = Reader.Int32(); Character.Action.Target = id3; Reader.Close(); client.Send(Packet.ActionState(1, 1)); Character.Action.PickUping = false; Player_Trace(id3); break; case 4: //use skill Character.Action.UsingSkillID = Reader.Int32(); SkillMain(Reader.Byte(), Reader); break; case 5: int id4 = Reader.Int32(); byte b_index = SkillGetBuffIndex(id4); SkillBuffEnd(b_index); break; default: Console.WriteLine("ActionMain case: " + Reader.Byte()); break; } } else { StopAttackTimer(); } } catch (Exception ex) { Systems.Debugger.Write(ex); } }
//########################################################################################### // Start teleporting //########################################################################################### void Teleport_Start() { try { lock (this) { //Checks before we continue if (Character.Action.PickUping) { return; } //Timer checks StopTimers(); //Open the packet reader PacketReader Reader = new PacketReader(PacketInformation.buffer); //Teleport id int teleportidinfo = Reader.Int32(); //Number byte number = Reader.Byte(); //Teleport selected int teleportselect = Reader.Int32(); Reader.Close(); //Find price information int price = Data.TeleportPrice.Find(pc => (pc.ID == number)).price; //If the user has less gold then it costs if (this.Character.Information.Gold < price) { //Send error message this.client.Send(Packet.IngameMessages(SERVER_TELEPORTSTART, IngameMessages.UIIT_MSG_INTERACTION_FAIL_NOT_ENOUGH_MONEY)); return; } //If the user level is lower then the required level if (Data.TeleportPrice.Find(dd => (dd.ID == teleportselect)).level > 0 && Character.Information.Level < Data.TeleportPrice.Find(dd => (dd.ID == teleportselect)).level) { client.Send(Packet.IngameMessages(SERVER_TELEPORTSTART, IngameMessages.UIIT_MSG_INTERACTION_FAIL_OUT_OF_REQUIRED_LEVEL_FOR_TELEPORT)); return; } //If the user is currently with job transport (TODO). //Update players gold this.Character.Information.Gold -= price; //Update players gold in database SaveGold(); //Close buffs BuffAllClose(); //Send teleport packet #1 this.client.Send(Packet.TeleportStart()); //Set state this.Character.InGame = false; //Update location Teleport_UpdateXYZ(Convert.ToByte(teleportselect)); //Despawn objects ObjectDeSpawnCheck(); //Despawn player to other players DeSpawnMe(); //Required client.Send(Packet.TeleportStart2()); //Send loading screen image this.client.Send(Packet.TeleportImage(Data.PointBase[Convert.ToByte(teleportselect)].xSec, Data.PointBase[Convert.ToByte(teleportselect)].ySec)); //Set bool this.Character.Teleport = true; } } catch (Exception ex) { Console.WriteLine("Teleport select error {0}", ex); Systems.Debugger.Write(ex); } }
///////////////////////////////////////////////////////////////////////////////// // Item Switch ///////////////////////////////////////////////////////////////////////////////// void ItemMain() { #region Item Actions try { if (Character.State.Die || Character.Information.Scroll) { return; } PacketReader Reader = new PacketReader(PacketInformation.buffer); byte iType = Reader.Byte(); switch (iType) { case 0: if (Character.State.Busy) { return; } ItemMove(Reader.Byte(), Reader.Byte(), Reader.Int16()); break; case 1: ItemMoveInStorage(Reader.Byte(), Reader.Byte(), Reader.Int16()); break; case 2: Player_MoveItemToStorage(Reader.Byte(), Reader.Byte(), Reader.Int32()); break; case 3: Player_MoveStorageItemToInv(Reader.Byte(), Reader.Byte(), Reader.Int32()); break; case 4: ItemMoveToExhangePage(Reader.Byte()); break; case 5: ItemMoveExchangeToInv(Reader.Byte()); break; case 8: Player_BuyItem(Reader.Byte(), Reader.Byte(), Reader.Int16(), Reader.Int32()); break; case 9: Player_SellItem(Reader.Byte(), Reader.Int16(), Reader.UInt16()); break; case 7: if (Character.State.Busy) { return; } Player_DropItem(Reader.Byte()); break; case 10: if (Character.State.Busy) { return; } Player_DropGold(Reader.UInt64()); break; case 11: Player_TakeGoldW(iType, Reader.Int64()); break; case 12: Player_GiveGoldW(iType, Reader.Int64()); break; case 13: ItemExchangeGold(Reader.Int64()); break; case 16: MovePetToPet(Reader.Int32(), Reader.Byte(), Reader.Byte(), Reader.Int16()); break; case 24: Player_BuyItemFromMall(Reader.Byte(), Reader.Byte(), Reader.Byte(), Reader.Byte(), Reader.Byte(), Reader.Text()); break; case 26: MoveItemFromPet(Reader.Int32(), Reader.Byte(), Reader.Byte()); break; case 27: MoveItemToPet(Reader.Int32(), Reader.Byte(), Reader.Byte()); break; case 29: ItemMoveInStorage(Reader.Byte(), Reader.Byte(), Reader.Int16()); //Move inside guild storage break; case 30: Player_MoveItemToStorage(Reader.Byte(), Reader.Byte(), Reader.Int32()); //Move to guild storage break; case 31: Player_MoveStorageItemToInv(Reader.Byte(), Reader.Byte(), Reader.Int32()); //Move from guild storage break; case 32: Player_GiveGoldW(iType, Reader.Int64()); //Guild storage break; case 33: Player_TakeGoldW(iType, Reader.Int64()); //Guild storage break; case 35: ItemAvatarUnEquip(Reader.Byte(), Reader.Byte()); break; case 36: ItemAvatarEquip(Reader.Byte(), Reader.Byte()); break; default: Print.Format("Unknown Item Function:{0}:{1}", iType, Decode.StringToPack(PacketInformation.buffer)); break; } Reader.Close(); } catch (Exception ex) { Console.WriteLine("Item Switch Error {0}", ex); } #endregion }