public void PlayerDeleteMail(GPlayer PL, Packet packet) { var _db = new PangyaEntities(); int Ret = 0; if (!packet.ReadUInt32(out uint Count)) { return; } try { for (var I = 0; I <= Count - 1; I++) { if (!packet.ReadUInt32(out uint MailIndex)) { return; } Ret = (int)_db.ProcDelMail((int)PL.GetUID, (int)MailIndex).FirstOrDefault(); } if (Ret == 0) { PL.SendResponse(new byte[] { 0x14, 0x02, 0xFA, 0x16, 0x2D, 0x00 });//still have an item in email so cannot be deleted return; } PlayerGetMailList(PL, packet, true); } catch { PL.Close(); } }
public void PlayerDailyLoginItem(GPlayer player) { PangyaBinaryWriter Packet; Packet = new PangyaBinaryWriter(); try { var _db = new PangyaEntities(); var DailyLogin = _db.ProcAlterDaily((int)player.GetUID).FirstOrDefault(); Packet.Write(new byte[] { 0x49, 0x02 }); Packet.WriteUInt32(0); Packet.WriteByte(1); Packet.WriteInt32(DailyLogin.Item_TypeID); Packet.WriteInt32(DailyLogin.Item_Quantity); Packet.WriteInt32(DailyLogin.Item_TypeID_Next); Packet.WriteInt32(DailyLogin.Item_Quantity_Next); Packet.WriteInt32(DailyLogin.counter); player.SendResponse(Packet); } catch { player.Close(); } finally { if (Packet != null) { Packet.Dispose(); } } }
public void PlayerReadMail(GPlayer PL, Packet packet) { var _db = new PangyaEntities(); PangyaBinaryWriter Reply; if (!packet.ReadUInt32(out uint MailIndex)) { return; } Reply = new PangyaBinaryWriter(); var QueryList = _db.ProcReadMail((int)PL.GetUID, (int)MailIndex).ToList(); try { if (QueryList.Count > 0) { Reply.Write(new byte[] { 0x12, 0x02 }); Reply.Write((uint)0); Reply.Write(QueryList.First().Mail_Index); //Select Page Reply.WritePStr(QueryList.First().Sender); //Sender Reply.WritePStr(QueryList.First().RegDate.ToString()); //IsRead Reply.WritePStr(QueryList.First().Msg); Reply.Write((byte)1); Reply.Write(QueryList.Count);//FF FF FF FF foreach (var data in QueryList) { Reply.Write(uint.MaxValue); Reply.Write(data.TYPEID); //typeID Reply.Write(Convert.ToByte(data.IsTime)); Reply.Write(data.QTY ?? 0); //quantidade Reply.Write(Convert.ToUInt32(data.DAY ?? 0)); //dias Reply.WriteZero(16); Reply.Write(4294967295); //FF FF FF FF Reply.Write(0); Reply.WriteStr(IsUCCNull(data.UCC_UNIQUE), 14); //UCC_UNIQUE } PL.SendResponse(Reply.GetBytes()); } else { Reply.Write(new byte[] { 0x12, 0x02 }); Reply.Write((uint)2); PL.SendResponse(Reply.GetBytes()); } } catch { PL.Close(); } }
public override void PlayerShotData(GPlayer player, Packet packet) { TShotData S; player.GameInfo.Versus.ShotSync = false; var decrypted = DecryptShot(packet.GetRemainingData); packet.SetReader(new PangyaBinaryReader(new MemoryStream(decrypted))); S = (TShotData)packet.Read(new TShotData()); if (S.ShotType == TShotType.Success) { if (player.GameInfo.GameData.Pang - S.Pang > 4000 || player.GameInfo.GameData.BonusPang - S.BonusPang > 4000) { player.Close(); return; } player.GameInfo.GameData.Pang = S.Pang; player.GameInfo.GameData.BonusPang = S.BonusPang; player.GameInfo.GameData.HoleComplete = true; player.GameInfo.GameData.HoleCompletedCount += 1; player.GameInfo.UpdateScore(player.GameInfo.GameData.HoleComplete); if (player.GameInfo.GameData.HoleCompletedCount >= fGameData.HoleTotal) { player.GameInfo.GameCompleted = true; } WriteConsole.WriteLine(player.GameInfo.GameData.Score.ToString()); } else if (S.ShotType == TShotType.OB) { player.GameInfo.GameData.ShotCount += 2; player.GameInfo.GameData.TotalShot += 2; } else { player.GameInfo.GameData.ShotCount += 1; player.GameInfo.GameData.TotalShot += 1; player.GameInfo.GameData.Pang = S.Pang; player.GameInfo.GameData.BonusPang = S.BonusPang; } var result = new PangyaBinaryWriter(); result.Write(new byte[] { 0x64, 0x00 }); result.WriteStruct(S); Send(result.GetBytes()); player.GameInfo.Versus.HoleDistance = S.Pos.HoleDistance(player.GameInfo.HolePos3D); Console.WriteLine("[PLAYER_HOLE_DISTANCE]: " + player.GameInfo.Versus.HoleDistance); }
protected void GetNormalItem(GPlayer player, uint TypeID) { try { var NormalItem = Items.GetNormalItem(TypeID); // ## add to item list foreach (var PNormal in NormalItem) { var NormalAddItem = new AddItem { ItemIffId = PNormal.TypeID, Quantity = PNormal.Quantity, Transaction = true, Day = 0 }; // ## add to warehouse player.AddItem(NormalAddItem); } // ## send transaction player.SendTransaction(); // 0 = ITEM COMUM // 1 = ITEM NORMAL ASA FECHADA // 2 = ITEM NORMAL ASA ABERTA // 3 = ITEM RARO ASA FECHADA // 4 = ITEM RARO ASA ABERTA player.Response.Write(new byte[] { 0x64, 0x02 }); player.Response.Write(0); player.Response.Write(NormalItem.Count); foreach (var PNormal in NormalItem) { player.Response.WriteUInt32(PNormal.RareType); // ALTERAR AQUI TIPO DE ITEM player.Response.WriteUInt32(PNormal.TypeID); player.Response.WriteUInt32(PNormal.Quantity); } player.SendResponse(); } catch { player.Close(); } }
public static void PlayerPlayScratchCard(GPlayer player) { uint Count, I, IQuantity = 0; AddData ItemData; ItemRandom Reward; AddItem AddItemData; PangyaBinaryWriter Packet; Random rnd; try { Packet = new PangyaBinaryWriter(); ItemData = new AddData(); rnd = new Random(); foreach (var Supply in RandomWeight.FSupplies) { ItemData = player.Inventory.Remove(Supply.TypeId, Supply.DelQuantity); if (ItemData.Status) { break; } } if (!ItemData.Status)// ## item can't be deleted { player.SendResponse(new byte[] { 0xDD, 0x00, 0xE4, 0xC6, 0x2D, 0x00, }); return; } if (new Random(0x64).Next() < 10) { Count = 2; } else { Count = 1; } Packet.WriteUInt32(Count); for (I = 1; I <= Count; I++) { Reward = RandomWeight.GetItems(); if (rnd.Next(0x64) < 10) { IQuantity = Reward.MaxQuantity; } else { IQuantity = 1; } AddItemData = new AddItem { ItemIffId = Reward.TypeId, Quantity = IQuantity, Transaction = true, Day = 0 }; ItemData = player.AddItem(AddItemData); if (ItemData.ItemTypeID == 0) { player.SendResponse(new byte[] { 0xDD, 0x00, 0x05, 0x00, 0x00, 0x00, }); return; } Packet.Write(0); Packet.WriteUInt32(ItemData.ItemTypeID); Packet.WriteUInt32(ItemData.ItemIndex); Packet.WriteUInt32(IQuantity); Packet.Write(1);//rare item? } player.SendTransaction(); player.SendResponse(new byte[] { 0xDD, 0x00, 0x00, 0x00, 0x00, 0x00 }, Packet.GetBytes()); RandomWeight.Restore(); } catch { player.Close(); } }
public override void PlayerShotData(GPlayer player, Packet packet) { TShotData S; player.GameInfo.Versus.ShotSync = false; var decrypted = DecryptShot(packet.ReadBytes((int)(packet.GetSize - packet.GetPos))); packet.SetReader(new PangyaBinaryReader(new MemoryStream(decrypted))); S = (TShotData)packet.Read(new TShotData()); switch (S.ShotType) { case TShotType.Unknown: case TShotType.Normal: player.GameInfo.GameData.Pang += S.Pang; player.GameInfo.GameData.BonusPang += S.BonusPang; player.GameInfo.GameData.ShotCount += 1; player.GameInfo.GameData.TotalShot += 1; break; case TShotType.OB: { player.GameInfo.GameData.Pang += S.Pang; player.GameInfo.GameData.BonusPang += S.BonusPang; player.GameInfo.GameData.ShotCount += 2; player.GameInfo.GameData.TotalShot += 2; } break; case TShotType.Success: { if (player.GameInfo.GameData.Pang - S.Pang > 4000 || player.GameInfo.GameData.BonusPang - S.BonusPang > 4000) { player.Close(); return; } player.GameInfo.GameData.HoleComplete = true; player.GameInfo.GameData.HoleCompletedCount += 1; player.GameInfo.UpdateScore(player.GameInfo.GameData.HoleComplete); if (player.GameInfo.GameData.HoleCompletedCount >= fGameData.HoleTotal) { player.GameInfo.GameCompleted = true; } WriteConsole.WriteLine(player.GameInfo.GameData.Score.ToString()); } break; } packet.Clear(); packet.Write(new byte[] { 0x6E, 0x00 }); packet.WriteUInt32(player.ConnectionID); packet.WriteByte((byte)player.GameInfo.HolePos); packet.WriteSingle(S.Pos.X); packet.WriteSingle(S.Pos.Z); packet.Write(S.MatchData); Send(packet.GetBytes()); player.GameInfo.Versus.HoleDistance = S.Pos.HoleDistance(player.GameInfo.HolePos3D); Console.WriteLine("[PLAYER_HOLE_DISTANCE]: " + player.GameInfo.Versus.HoleDistance); }
protected void GetRareItem(GPlayer player, uint TypeID) { AddItem AddItem; //For normal item //Form Rare item ItemRandomClass RareItem; ItemRandom PRare; List <Dictionary <uint, uint> > ListSet; try { RareItem = Items.GetRareItem(IffEntry.MemorialCoin.GetPool(TypeID)); while (true) { PRare = null; if (RareItem.GetLeft() <= 0) { break; } PRare = RareItem.GetItems(); if (!player.Inventory.IsExist(PRare.TypeId)) { break; } } if (PRare == null) { player.SendResponse(new byte[] { 0x64, 0x02, 0xAD, 0x0F9, 0x56, 0x00 }); WriteConsole.WriteLine("PlayerPlayerMemorialGacha: object is Null", ConsoleColor.Red); } if (GetItemGroup(PRare.TypeId) == 9) { ListSet = IffEntry.SetItem.SetList(PRare.TypeId); if (ListSet.Count <= 0) { player.SendResponse(new byte[] { 0x64, 0x02, 0xAD, 0x0F9, 0x56, 0x00 }); WriteConsole.WriteLine("PlayerPlayerMemorialGacha: Failed", ConsoleColor.Red); // ## should not be happened return; } foreach (var data in ListSet) { AddItem = new AddItem() { ItemIffId = data.Keys.FirstOrDefault(), Quantity = data.Values.FirstOrDefault(), Transaction = true, Day = 0// ## set should not be limited time in their set }; player.AddItem(AddItem); } } else { AddItem = new AddItem { ItemIffId = PRare.TypeId, Quantity = PRare.MaxQuantity, Transaction = true, Day = 0, }; player.AddItem(AddItem); } // ## send transaction player.SendTransaction(); // 0 = ITEM COMUM // 1 = ITEM NORMAL ASA FECHADA // 2 = ITEM NORMAL ASA ABERTA // 3 = ITEM RARO ASA FECHADA // 4 = ITEM RARO ASA ABERTA player.Response.Write(new byte[] { 0x64, 0x02 }); player.Response.Write(0); player.Response.Write(1); player.Response.Write(PRare.RareType); player.Response.WriteUInt32(PRare.TypeId); player.Response.WriteUInt32(PRare.MaxQuantity); player.SendResponse(); } catch { player.Close(); } }
public void PlayerLogin(GPlayer PL, Packet packet) { //GameServer GameServer; if (!packet.ReadPStr(out string UserID)) { WriteConsole.WriteLine("[CLIENT_PLAYER]: USER UNKNOWN"); PL.SendResponse(new byte[] { 0x76, 0x02, 0x2C, 0x01, 0x00, 0x00 }); // ## send code 300 PL.Close(); return; } if (!packet.ReadUInt32(out uint UID)) { WriteConsole.WriteLine("[CLIENT_ERROR]: UID UNKNOWN"); PL.SendResponse(new byte[] { 0x76, 0x02, 0x2C, 0x01, 0x00, 0x00 }); // ## send code 300 PL.Close(); return; } var PlayerCheck = Program._server.Players.Model.Where(c => c.GetUID == UID); if (PlayerCheck.Any()) { WriteConsole.WriteLine("[CLIENT_CHECK]: PLAYER LOGIN DUPLICATE", ConsoleColor.Red); PL.SendResponse(new byte[] { 0x76, 0x02, 0x2C, 0x01, 0x00, 0x00 }); // ## send code 300 PL.SetLogin(UserID); foreach (GPlayer pl in PlayerCheck) { pl.Close(); } return; } packet.Skip(6); if (!packet.ReadPStr(out string Code1)) { WriteConsole.WriteLine("[CLIENT_ERROR]: AUTHLOGIN UNKNOWN"); PL.SendResponse(new byte[] { 0x76, 0x02, 0x2C, 0x01, 0x00, 0x00 }); // ## send code 300 PL.Close(); return; } if (!packet.ReadPStr(out string Version)) { WriteConsole.WriteLine("[CLIENT_ERROR]: Client Version Incompartible"); PL.Send(new byte[] { 0x44, 0x00, 0x0B }); PL.Close(); return; } if (!Program.CheckVersion(Version)) { WriteConsole.WriteLine("[CLIENT_ERROR]: Client Version Incompartible"); PL.Send(new byte[] { 0x44, 0x00, 0x0B }); PL.Close(); return; } packet.Skip(8); if (!packet.ReadPStr(out string Code2)) { WriteConsole.WriteLine("[CLIENT_ERROR]: AUTHGAME UNKNOWN"); PL.SendResponse(new byte[] { 0x76, 0x02, 0x2C, 0x01, 0x00, 0x00 }); // ## send code 300 PL.Close(); return; } try { var _db = new PangyaEntities(); var Query = _db.USP_GAME_LOGIN(UserID, (int)UID, Code1, Code2).FirstOrDefault(); byte Code = (byte)Query.Code; if (Code != 1) { PL.SendResponse(new byte[] { 0x76, 0x02, 0x2C, 0x01, 0x00, 0x00 }); // ## send code 300 WriteConsole.WriteLine("[CLIENT_ERROR]: PLAYER NULL", ConsoleColor.Red); PL.SetLogin(UserID); PL.Close(); return; } PL.SetLogin(Query.Username); PL.SetNickname(Query.Nickname); PL.SetSex((byte)Query.Sex); PL.SetCapabilities((byte)Query.Capabilities); PL.SetUID(UID); PL.SetCookie((uint)Query.Cookie); PL.LockerPang = (uint)Query.PangLockerAmt; PL.LockerPWD = Query.LockerPwd; PL.SetAuthKey1(Code1); PL.SetAuthKey2(Code2); if (Code == 1) { PL.LoadStatistic(); PL.LoadGuildData(); SendJunkPackets(PL); PlayerRequestInfo(PL, Version); } } catch { PL.Close(); } finally { packet.Dispose(); } }
public static void PlayerTutorialMission(GPlayer player, Packet packet) { var data = (Tutorial)packet.Read(new Tutorial()); var SetTutorial = player.TutorialCompleted; if (SetTutorial == false) { player.SetTutorial(data.Code, data.MissionID); } var db = new PangyaEntities(); try { var GetTutorial = db.ProcGetTutorial((int)player.GetUID).First(); switch ((TutorialType)data.Code) { case TutorialType.Rookie: case TutorialType.NewRookie: { data.Code = 0; switch (data.MissionID) { case 1: //não é necessario setar, mas eu seto, só por precausao { data.MissionID = 1; } break; case 2: { data.MissionID = 3; } break; case 4: { data.MissionID = (uint)GetTutorial.Rookie; } break; case 8: { data.MissionID = (uint)GetTutorial.Rookie; } break; case 16: { data.MissionID = (uint)GetTutorial.Rookie; } break; case 32: { data.MissionID = (uint)GetTutorial.Rookie; } break; case 64: { data.MissionID = (uint)GetTutorial.Rookie; } break; case 128: { data.MissionID = byte.MaxValue; } break; } } break; case TutorialType.Beginner: { data.Code = 1; switch (data.MissionID) { case 256: { data.MissionID = 256; //missão 10 } break; case 512: { data.MissionID = (uint)GetTutorial.Beginner; //missão 11 } break; case 1024: { data.MissionID = (uint)GetTutorial.Beginner; //missão 12 } break; case 2048: { data.MissionID = (uint)GetTutorial.Beginner; //missão 13 } break; case 4096: { data.MissionID = (uint)GetTutorial.Beginner; //missão 14 } break; case 8192: { data.MissionID = (uint)GetTutorial.Beginner; //missão 15 } break; } } break; } //1F 01 01 0100 01 00 00 player.SendResponse(ShowTutorialPlayer(data.Code, data.MissionID)); //player.SendMailPopup(); } catch { player.Close(); } finally { if (db != null) { db.Dispose(); } } }
public void PlayerLoloCardDeck(GPlayer PL, Packet packet) { TCardDataChange CardData; PlayerCardData PlayerCard; PlayerCardData PlayerCard2; PlayerCardData PlayerCard3; CardData = (TCardDataChange)packet.Read(new TCardDataChange()); //// ## get card PlayerCard = PL.Inventory.ItemCard.GetCard(CardData.CardTypeID, 1); PlayerCard2 = PL.Inventory.ItemCard.GetCard(CardData.CardTypeID2, 1); PlayerCard3 = PL.Inventory.ItemCard.GetCard(CardData.CardTypeID3, 1); try { //Check is Card Exist if (PlayerCard == null || PlayerCard2 == null || PlayerCard3 == null) { PL.SendResponse(new byte[] { 0x2A, 0x02, 0x01, 0x00, 0x00, 0x00, }); WriteConsole.WriteLine("HandlePlayerLoloDeck: is null", ConsoleColor.Red); return; } // ## delete PL card if (!PL.Inventory.Remove(PlayerCard.CardTypeID, 1, true).Status || !PL.Inventory.Remove(PlayerCard2.CardTypeID, 1, true).Status || !PL.Inventory.Remove(PlayerCard3.CardTypeID, 1, true).Status) { PL.SendResponse(new byte[] { 0x2A, 0x02, 0x01, 0x00, 0x00, 0x00, }); WriteConsole.WriteLine("HandlePlayerLoloDeck: Card No Found", ConsoleColor.Red); return; } if (!PL.RemovePang((uint)CardData.PangSum)) { PL.SendResponse(new byte[] { 0x2A, 0x02, 0x01, 0x00, 0x00, 0x00, }); WriteConsole.WriteLine("HandlePlayerLoloDeck: Pangs null", ConsoleColor.Red); return; } // ## get random card var Card = Items.GetCard(PlayerCard.CardTypeID, PlayerCard2.CardTypeID, PlayerCard3.CardTypeID); if (Card.TypeID > 0) { var result = new byte[] { 0x2E, 0x02, 0x00, 0x00, 0x00, 0x00 }; PL.SendResponse(result); result = new byte[] { 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; PL.SendResponse(result); result = new byte[] { 0x29, 0x02, 0x02, 0x00, 0x00, 0x00 }; PL.SendResponse(result); PL.SendPang(); PL.AddItem(new AddItem() { ItemIffId = Card.TypeID, Quantity = 1, Day = 0, Transaction = true }); PL.SendTransaction(); PL.Response.Write(new byte[] { 0x2A, 0x02 }); PL.Response.Write(0); PL.Response.Write(Card.TypeID); PL.SendResponse(); } else { PL.SendResponse(new byte[] { 0x2A, 0x02, 0x00, 0x00, 0x00, 0x00 }); WriteConsole.WriteLine("HandlePlayerLoloDeck: Fatal Error", ConsoleColor.Red); return; } } catch { PL.Close(); } }
public void PlayerOpenBox(GPlayer player, Packet packet) { TRewardInfo Reward; TBoxInfo BoxInfo; AddData RemoveItemData; AddData AddItemData; AddItem Item; string Param = ""; List <object> Lists; object APoint; MailSender MailSender; Lists = new List <object>(); try { if (!packet.ReadUInt32(out uint BoxIffTypeID)) { return; } AddItemData = new AddData(); BoxInfo = BoxItem.GetBoxInfo(BoxIffTypeID); // # Box doens't exist if ((BoxInfo == null)) { player.Write(OPEN_BOX_NULL); WriteConsole.WriteLine($"HandlePlayerOpenBox: Cannot find system\'s box to open { BoxIffTypeID }", ConsoleColor.Red); return; } // # Player does not have this box if (!player.Inventory.IsExist(BoxInfo.BoxTypeID)) { player.Write(OPEN_BOX_NULL); WriteConsole.WriteLine($"HandlePlayerOpenBox: Player hasn\'t had this box { BoxIffTypeID }", ConsoleColor.Red); return; } // # Special item to delete # use for openned cube if ((BoxInfo.SupplyTypeID > 0)) { if (!player.Inventory.IsExist(BoxInfo.SupplyTypeID)) { player.Write(OPEN_BOX_NULL); WriteConsole.WriteLine($"HandlePlayerOpenBox: Can\'t find player\'s supply { BoxInfo.SupplyTypeID }", ConsoleColor.Red); return; } } // # delete box RemoveItemData = player.Inventory.Remove(BoxInfo.BoxTypeID, BoxInfo.BoxQuantity, false); // # add to list APoint = new TItemData(); ((TItemData)APoint).TypeID = RemoveItemData.ItemTypeID; ((TItemData)APoint).ItemIndex = RemoveItemData.ItemIndex; ((TItemData)APoint).ItemQuantity = RemoveItemData.ItemNewQty; Lists.Add((TItemData)APoint); // # end // # if supply typeid is specified if (BoxInfo.SupplyTypeID > 0) { // # delete supplyment # use for key's spin cube RemoveItemData = player.Inventory.Remove(BoxInfo.SupplyTypeID, BoxInfo.SupplyQuantity, false); // # add to list APoint = new TItemData(); ((TItemData)APoint).TypeID = RemoveItemData.ItemTypeID; ((TItemData)APoint).ItemIndex = RemoveItemData.ItemIndex; ((TItemData)APoint).ItemQuantity = RemoveItemData.ItemNewQty; Lists.Add((TItemData)APoint); // # end } // # if special reward is specified if ((BoxInfo.SpecialRewardTypeID > 0)) { Item = new AddItem() { ItemIffId = BoxInfo.SpecialRewardTypeID, Quantity = BoxInfo.SpecialRewardQuantity, Transaction = false, Day = 0 }; AddItemData = player.AddItem(Item); if ((AddItemData.ItemNewQty > 1)) { // # add to list APoint = new TItemData(); ((TItemData)APoint).TypeID = AddItemData.ItemTypeID; ((TItemData)APoint).ItemIndex = AddItemData.ItemIndex; ((TItemData)APoint).ItemQuantity = AddItemData.ItemNewQty; Lists.Add((TItemData)APoint); // # end } } // # send data to player player.Write(ShowBoxItem(Lists)); // # clear Lists.Clear(); // # send #$AA if ((AddItemData.ItemNewQty == 1)) { APoint = new TItemData(); ((TItemData)(APoint)).TypeID = AddItemData.ItemTypeID; ((TItemData)(APoint)).ItemIndex = AddItemData.ItemIndex; ((TItemData)(APoint)).ItemQuantity = AddItemData.ItemNewQty; Lists.Add((TItemData)APoint); } // send result player.Write(ShowBoxNewItem(Lists, player.GetPang, player.GetCookie)); while (true) { Reward = BoxItem.GetItemBox(BoxIffTypeID); if (!Reward.Duplicated) { // if this item can have only one ea if (!player.Inventory.IsExist(Reward.TypeId)) { break; } } else if (Reward.Duplicated) { break; } } if (Reward.TypeId <= 0) { player.Write(BOX_REWARD_NIL); WriteConsole.WriteLine($"HandlePlayerOpenBox: Reward is nil with box typeid: { BoxIffTypeID }"); return; } if (Reward.Announce) { // generate param Param = string.Format(" You got items from !! BoxAnnounce = <PARAMS> <BOX_TYPEID> {0} </ BOX_TYPEID> <NICKNAME> {1} </ NICKNAME> <TYPEID> {2}</ TYPEID> <QTY> {3} </ QTY>", new object[] { BoxIffTypeID, player.GetNickname, Reward.TypeId, Reward.Quantity }); var Auth = MainServer.Program._server.AuthServer; if (Auth != null) { Auth.Send(new AuthPacket() { ID = AuthPacketEnum.SERVER_RELEASE_BOXRANDOM, Message = new { GetMessage = Param } }); } else { player.Server.Notice(Param); } } try { MailSender = new MailSender { Sender = "@BoxSystem" }; MailSender.AddText(BoxInfo.BoxParam); MailSender.AddItem(Reward.TypeId, Reward.Quantity); MailSender.Send(player.GetUID); player.SendMailPopup(); } finally { MailSender = null; } player.Write(ShowBoxItem(BoxIffTypeID, Reward.TypeId, Reward.Quantity)); } catch { player.Close(); } finally { Lists.Clear(); } }
public void PlayerGetMailList(GPlayer PL, Packet packet, bool IsDel = false) { var _db = new PangyaEntities(); PangyaBinaryWriter Reply; if (!packet.ReadInt32(out int PageSelect)) { return; } Reply = new PangyaBinaryWriter(); var QueryList = _db.ProcGetMail((int)PL.GetUID, PageSelect, 20, 2).ToList(); try { if (IsDel) { Reply.Write(new byte[] { 0x15, 0x02 }); } else { Reply.Write(new byte[] { 0x11, 0x02 }); } Reply.Write(0); Reply.Write(PageSelect);//count if (QueryList.Count > 1) { Reply.Write(QueryList.FirstOrDefault().PAGE_TOTAL ?? 0); } else { Reply.Write(1); } Reply.Write(QueryList.Count); foreach (var mail in QueryList) { var type = Convert.ToUInt32(mail.SETTYPEID > 0 ? mail.SETTYPEID : mail.TYPEID); Reply.Write(mail.Mail_Index); //Mail_Index Reply.WriteStr(mail.Sender, 16); //Sender Reply.WriteZero(116); Reply.Write((byte)mail.IsRead); //) Reply.Write(mail.Mail_Item_Count ?? 0); //Mail_Total COunt Reply.Write(4294967295); Reply.Write(type); //typeID Reply.Write(Convert.ToByte(mail.IsTimer ?? 0)); //time Reply.Write(mail.QTY ?? 0); Reply.Write(Convert.ToUInt32(mail.DAY ?? 0)); Reply.WriteZero(16); Reply.Write(4294967295); Reply.Write(0); Reply.WriteStr(IsUCCNull(mail.UCC_UNIQUE), 14); } PL.SendResponse(Reply.GetBytes()); } catch { PL.Close(); } }
public void PlayerChangeEquipment(GPlayer player, Packet Reader) { PangyaBinaryWriter Reply; bool Status; if (!Reader.ReadByte(out byte action)) { return; } Status = false; Reply = new PangyaBinaryWriter(); try { Reply.Write(new byte[] { 0x6B, 0x00, 0x04 }); Reply.WriteByte(action); switch (action) { case 0: // ## save char equip { var invchar = (CharacterData)Reader.Read(new CharacterData()); var character = player.Inventory.GetCharacter(invchar.TypeID); if (character == null) { WriteConsole.WriteLine("[PLAYER_CHANGE_EQUIPCHAR]: Error Ao Tentar Setar EquipChar", ConsoleColor.Red); player.Close(); return; } character.EquipTypeID = invchar.EquipTypeID; character.EquipIndex = invchar.EquipIndex; character.AuxPart = invchar.AuxPart; character.AuxPart2 = invchar.AuxPart2; character.AuxPart3 = invchar.AuxPart3; character.AuxPart4 = invchar.AuxPart4; character.AuxPart5 = invchar.AuxPart5; character.FCutinIndex = invchar.FCutinIndex; character.Power = invchar.Power; character.Control = invchar.Control; character.Impact = invchar.Impact; character.Spin = invchar.Spin; character.Curve = invchar.Curve; player.Inventory.ItemCharacter.UpdateCharacter(character); Status = true; Reply.Write(player.Inventory.GetCharData(invchar.Index)); } break; case 1: // ## change caddie { Reader.ReadUInt32(out uint CaddiIndex); if (!player.Inventory.SetCaddieIndex(CaddiIndex)) { WriteConsole.WriteLine("[PLAYER_CHANGE_CADDIE]: Error Ao Tentar Setar CaddieIndex", ConsoleColor.Red); player.Close(); } Status = true; Reply.WriteUInt32(CaddiIndex); } break; case 2: // ## item for play { ItemSlotData ItemSlots; ItemSlots = (ItemSlotData)Reader.Read(new ItemSlotData()); player.Inventory.ItemSlot.SetItemSlot(ItemSlots); Status = true; Reply.Write(player.Inventory.ItemSlot.GetItemSlot()); } break; case 3: // ## Change Ball And Club { Reader.ReadUInt32(out uint BallTypeID); Reader.ReadUInt32(out uint ClubIndex); if (!player.Inventory.SetGolfEQP(BallTypeID, ClubIndex)) { WriteConsole.WriteLine("[PLAYER_CHANGE_EQUIP]: Error Ao Tentar Setar GolfEquip", ConsoleColor.Red); player.Close(); } Status = true; Reply.Write(player.Inventory.GetGolfEQP()); } break; case 4: // ## Change Decoration { var Decoration = (ItemDecorationData)Reader.Read(new ItemDecorationData()); if (!player.Inventory.SetDecoration(Decoration.BackGroundTypeID, Decoration.FrameTypeID, Decoration.StickerTypeID, Decoration.SlotTypeID, Decoration.UnknownTypeID, Decoration.TitleTypeID)) { WriteConsole.WriteLine("[PLAYER_CHANGE_DEC]: Error Ao Tentar Setar Decoration", ConsoleColor.Red); player.Close(); return; } Status = true; Reply.Write(player.Inventory.GetDecorationData()); } break; case 5: // ## change char { Reader.ReadUInt32(out uint CharacterIndex); if (!player.Inventory.SetCharIndex(CharacterIndex)) { WriteConsole.WriteLine("[PLAYER_CHANGE_CHAR]: Error Ao Tentar Setar CharIndex", ConsoleColor.Red); player.Close(); } Status = true; Reply.WriteUInt32(CharacterIndex); } break; case 8: // ## change mascot { Reader.ReadUInt32(out uint MascotIndex); if (!player.Inventory.SetMascotIndex(MascotIndex)) { WriteConsole.WriteLine("[PLAYER_CHANGE_MASCOT]: Error Ao Tentar Setar MascotIndex"); player.Close(); return; } Status = true; Reply.Write(player.Inventory.GetMascotData()); } break; case 9: // #Cutin { var CharacterIndex = Reader.ReadUInt32(); var CutinIndex = Reader.ReadUInt32(); if (!player.Inventory.SetCutInIndex(CharacterIndex, CutinIndex)) { WriteConsole.WriteLine("[PLAYER_CHANGE_CHARCUTIN]: Error Ao Tentar Setar Cutin", ConsoleColor.Red); player.Close(); } Status = true; Reply.Write(CharacterIndex); Reply.Write(CutinIndex); Reply.WriteZero(12); //12 byte vazios } break; default: WriteConsole.WriteLine("Action_Unkown: {0}, Array: {1}", new object[] { action, BitConverter.ToString(Reader.GetRemainingData) }); break; } if (Status) { player.SendResponse(Reply.GetBytes()); } } catch { } }
public void PlayerSaveBar(GPlayer player, Packet packet) { Channel Lobby; GameBase GameHandle; PlayerInventory Inventory; Lobby = player.Lobby; GameHandle = Lobby.GetGameHandle(player); Inventory = player.Inventory; packet.ReadByte(out byte action); packet.ReadUInt32(out uint id); try { var Response = new PangyaBinaryWriter(); Response.Write(new byte[] { 0x4B, 0x00 }); Response.WriteUInt32(0); Response.WriteByte(action); Response.WriteUInt32(player.ConnectionID); switch (action) { case 1: // ## caddie { if (!Inventory.SetCaddieIndex(id)) { player.Close(); return; } Response.Write(Inventory.GetCaddieData()); } break; case 2: // ## ball { if (!Inventory.SetBallTypeID(id)) { player.Close(); return; } Response.Write(id); } break; case 3: // ## club { if (!Inventory.SetClubSetIndex(id)) { player.Close(); return; } Response.Write(Inventory.GetClubData()); //clubdata temp } break; case 4: // ## char { if (!Inventory.SetCharIndex(id)) { player.Close(); return; } Response.Write(Inventory.GetCharData()); } break; case 5: // ## mascot { if (!Inventory.SetMascotIndex(id)) { player.Close(); return; } Response.Write(Inventory.GetMascotData()); } break; case 7: // ## start game { if (GameHandle == null) { return; } GameHandle.AcquireData(player); } break; } if (action == 4 && GameHandle != null) { GameHandle.Send(Response); //Atualizar GameHandle.Send(ShowActionGamePlayInfo(player)); if (GameHandle.GameType == GAME_TYPE.CHAT_ROOM) { //GameHandle.Send(ShowRoomEntrance(player.ConnectionID, 15)); } } else { player.SendResponse(Response.GetBytes()); } } catch { player.Close(); } }
public ItemRecycleCoreSystem(GPlayer player, Packet packet) { uint MP = 436208295, TikiPang = 0, TPCount = 0, Mileage = 0, Count = 0; List <TRecycleItemInfo> ItemList; TRecycleItemInfo ItemInfo; ItemList = new List <TRecycleItemInfo>(); try { if (!packet.ReadUInt32(out Count)) { return; } for (var i = 0; i < Count; i++) { ItemInfo = (TRecycleItemInfo)packet.Read(new TRecycleItemInfo()); ItemList.Add(ItemInfo); switch (GetItemGroup(ItemInfo.ItemTypeID)) { case TITEMGROUP.ITEM_TYPE_CARD: { } break; case TITEMGROUP.ITEM_TYPE_PART: { var part = IffEntry.Part.GetItem(ItemInfo.ItemTypeID); if (part.Base.TypeID > 0) { TikiPang += part.Base.TikiPang; TPCount += part.Base.TPCount; Mileage += part.Base.Mileage; } } break; case TITEMGROUP.ITEM_TYPE_CLUB: break; case TITEMGROUP.ITEM_TYPE_BALL: break; case TITEMGROUP.ITEM_TYPE_USE: break; case TITEMGROUP.ITEM_TYPE_CADDIE: break; case TITEMGROUP.ITEM_TYPE_SKIN: break; case TITEMGROUP.ITEM_TYPE_AUX: break; } } player.Inventory.ItemTransaction.Add(new PlayerTransactionData() { Types = 2, TypeID = MP, // MP ¾ÆÀÌÅÛ Index = 2020, //index item, PreviousQuan = 720, NewQuan = 734, UCC = string.Empty }); foreach (var item in ItemList) { player.Inventory.ItemTransaction.Add(new PlayerTransactionData() { Types = 2, TypeID = item.ItemTypeID, Index = item.ItemIndex, PreviousQuan = item.ItemQuantity, NewQuan = item.ItemQuantity - Count, UCC = string.Empty }); } player.SendTransaction(); player.SendResponse(PacketCreator.ShowReceiveMileage(0, Mileage, TPCount)); } catch { player.Close(); } }
public void CheckUserForGift(GPlayer player, Packet packet) { var _db = new PangyaEntities(); if (!packet.ReadByte(out byte Type)) { player.SendResponse(new byte[] { 0xA1, 0x00, 0x02 }); return; } try { switch (Type) { case 1: //friend { if (!packet.ReadPStr(out string UserName)) { player.SendResponse(new byte[] { 0xA1, 0x00, 0x02 }); return; } var Query = _db.ProcCheckUsername(UserName).ToList(); if (Query.Count <= 0) { player.SendResponse(new byte[] { 0xA1, 0x00, 0x02 }); } else { var data = Query.First(); player.SendResponse(ShowUserGift(data.UID, data.Username, data.Nickname)); } } break; case 0: //no friend { packet.ReadPStr(out string UserName); var Query = _db.ProcCheckUsername(UserName).ToList(); if (Query.Count <= 0) { player.SendResponse(new byte[] { 0xA1, 0x00, 0x02 }); return; } else { var data = Query.First(); player.SendResponse(ShowUserGift(data.UID, data.Username, data.Nickname)); } } break; default: { player.Response.Write(new byte[] { 0xA1, 0x00 }); player.Response.WriteByte(2); player.SendResponse(); } break; } } catch { player.Close(); } }