public static void HandleAddAuction(int index, ref byte[] data) { int InvItem; int ItemNum; int Price; int MaxPrice; ByteStream buffer = new ByteStream(data); InvItem = buffer.ReadInt32(); Price = buffer.ReadInt32(); MaxPrice = buffer.ReadInt32(); buffer.Dispose(); ItemNum = S_Players.GetPlayerInvItemNum(index, InvItem); if (Price > 0) { AddAuction(index, ItemNum, 1, Price, MaxPrice); } else { S_NetworkSend.PlayerMsg(index, "Your Price Must Be Above 0!", (int)Enums.ColorType.Red); } }
internal static void LearnRecipe(int index, int RecipeNum, int InvNum) { if (CheckLearnedRecipe(index, RecipeNum)) { S_NetworkSend.PlayerMsg(index, "You allready know this recipe!", (int)Enums.ColorType.BrightRed); } else { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].RecipeLearned[RecipeNum] = 1; S_NetworkSend.PlayerMsg(index, "You learned the " + Recipe[RecipeNum].Name + " recipe!", (int)Enums.ColorType.BrightGreen); S_Players.TakeInvItem(index, S_Players.GetPlayerInvItemNum(index, InvNum), 0); modDatabase.SavePlayer(index); S_NetworkSend.SendPlayerData(index); } }
public static void Packet_DropItem(int index, ref byte[] data) { int InvNum; int Amount; ByteStream buffer = new ByteStream(data); S_General.AddDebug("Recieved CMSG: CMapDropItem"); InvNum = buffer.ReadInt32(); Amount = buffer.ReadInt32(); buffer.Dispose(); if (modTypes.TempPlayer[index].InBank || Convert.ToBoolean(modTypes.TempPlayer[index].InShop)) { return; } // Prevent hacking if (InvNum < 1 || InvNum > Constants.MAX_INV) { return; } if (S_Players.GetPlayerInvItemNum(index, InvNum) < 1 || S_Players.GetPlayerInvItemNum(index, InvNum) > Constants.MAX_ITEMS) { return; } if (Types.Item[S_Players.GetPlayerInvItemNum(index, InvNum)].Type == (int)Enums.ItemType.Currency || Types.Item[S_Players.GetPlayerInvItemNum(index, InvNum)].Stackable == 1) { if (Amount < 1 || Amount > S_Players.GetPlayerInvItemValue(index, InvNum)) { return; } } // everything worked out fine S_Players.PlayerMapDropItem(index, InvNum, Amount); }
internal static void CheckTask(int index, int QuestNum, int TaskType, int Targetindex) { int ActualTask; int I; ActualTask = modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask; if (ActualTask >= Quest[QuestNum].Task.Length) { return; } switch (TaskType) { case (int)Enums.QuestType.Slay // defeat X amount of X npc's. : { // is npc defeated id same as the npc i have to defeat? if (Targetindex == Quest[QuestNum].Task[ActualTask].NPC) { // Count +1 modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount = modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount + 1; // did i finish the work? if (modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount >= Quest[QuestNum].Task[ActualTask].Amount) { QuestMessage(index, QuestNum, Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Task[ActualTask].TaskLog) + " - Task completed", 0); // is the quest's end? if (CanEndQuest(index, QuestNum)) { EndQuest(index, QuestNum); } else { // otherwise continue to the next task modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask = ActualTask + 1; } } } break; } case (int)Enums.QuestType.Collect // Gather X amount of X item. : { if (Targetindex == Quest[QuestNum].Task[ActualTask].Item) { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount = modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount + 1; if (modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount >= Quest[QuestNum].Task[ActualTask].Amount) { QuestMessage(index, QuestNum, Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Task[ActualTask].TaskLog) + " - Task completed", 0); if (CanEndQuest(index, QuestNum)) { EndQuest(index, QuestNum); } else { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask = ActualTask + 1; } } } break; } case (int)Enums.QuestType.Talk // Interact with X npc. : { if (Targetindex == Quest[QuestNum].Task[ActualTask].NPC && Quest[QuestNum].Task[ActualTask].Amount == 0) { QuestMessage(index, QuestNum, Quest[QuestNum].Task[ActualTask].Speech, 0); if (CanEndQuest(index, QuestNum)) { EndQuest(index, QuestNum); } else { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask = ActualTask + 1; } } break; } case (int)Enums.QuestType.Reach // Reach X map. : { if (Targetindex == Quest[QuestNum].Task[ActualTask].Map) { QuestMessage(index, QuestNum, Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Task[ActualTask].TaskLog) + " - Task completed", 0); if (CanEndQuest(index, QuestNum)) { EndQuest(index, QuestNum); } else { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask = ActualTask + 1; } } break; } case (int)Enums.QuestType.Give // Give X amount of X item to X npc. : { if (Targetindex == Quest[QuestNum].Task[ActualTask].NPC) { for (I = 1; I <= Constants.MAX_INV; I++) { if (S_Players.GetPlayerInvItemNum(index, I) == Quest[QuestNum].Task[ActualTask].Item) { if (S_Players.GetPlayerInvItemValue(index, I) >= Quest[QuestNum].Task[ActualTask].Amount) { S_Players.TakeInvItem(index, S_Players.GetPlayerInvItemNum(index, I), Quest[QuestNum].Task[ActualTask].Amount); QuestMessage(index, QuestNum, Quest[QuestNum].Task[ActualTask].Speech, 0); if (CanEndQuest(index, QuestNum)) { EndQuest(index, QuestNum); } else { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask = ActualTask + 1; } break; } } } } break; } case (int)Enums.QuestType.Kill // Kill X amount of players. : { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount = modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount + 1; if (modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount >= Quest[QuestNum].Task[ActualTask].Amount) { QuestMessage(index, QuestNum, Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Task[ActualTask].TaskLog) + " - Task completed", 0); if (CanEndQuest(index, QuestNum)) { EndQuest(index, QuestNum); } else { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask = ActualTask + 1; } } break; } case (int)Enums.QuestType.Gather // Hit X amount of times X resource. : { if (Targetindex == Quest[QuestNum].Task[ActualTask].Resource) { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount = modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount + 1; if (modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].CurrentCount >= Quest[QuestNum].Task[ActualTask].Amount) { QuestMessage(index, QuestNum, Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Task[ActualTask].TaskLog) + " - Task completed", 0); if (CanEndQuest(index, QuestNum)) { EndQuest(index, QuestNum); } else { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask = ActualTask + 1; } } } break; } case (int)Enums.QuestType.Fetch // Get X amount of X item from X npc. : { if (Targetindex == Quest[QuestNum].Task[ActualTask].NPC) { S_Players.GiveInvItem(index, Quest[QuestNum].Task[ActualTask].Item, Quest[QuestNum].Task[ActualTask].Amount); QuestMessage(index, QuestNum, Quest[QuestNum].Task[ActualTask].Speech, 0); if (CanEndQuest(index, QuestNum)) { EndQuest(index, QuestNum); } else { modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].ActualTask = ActualTask + 1; } } break; } } SendPlayerQuest(index, QuestNum); }