public void Initialize(ref WS_PlayerData.CharacterObject objCharacter) { if (ObjectivesDeliver > 0) { ItemObject tmpItem = new(ObjectivesDeliver, objCharacter.GUID); if (!objCharacter.ItemADD(ref tmpItem)) { tmpItem.Delete(); Packets.PacketClass response = new(Opcodes.SMSG_QUESTGIVER_QUEST_FAILED); response.AddInt32(ID); response.AddInt32(4); objCharacter.client.Send(ref response); response.Dispose(); return; } objCharacter.LogLootItem(tmpItem, 1, Recieved: true, Created: false); } byte i = 0; do { checked { if (ObjectivesItem[i] != 0) { ProgressItem[i] = (byte)objCharacter.ItemCOUNT(ObjectivesItem[i]); } i = (byte)unchecked ((uint)(i + 1)); } }while (i <= 3u); if (((uint)ObjectiveFlags & 2u) != 0) { Explored = false; } IsCompleted(); }
public void Check() { if (Looters.Count != Rolls.Count) { return; } byte maxRollType = 0; foreach (KeyValuePair <WS_PlayerData.CharacterObject, int> looter2 in Looters) { if (looter2.Value == 1) { maxRollType = 1; } if (looter2.Value == 2 && maxRollType != 1) { maxRollType = 2; } } if (maxRollType == 0) { LootObject.GroupLootInfo.Remove(LootSlot); Packets.PacketClass response2 = new(Opcodes.SMSG_LOOT_ALL_PASSED); response2.AddUInt64(LootObject.GUID); response2.AddInt32(LootSlot); response2.AddInt32(Item.ItemID); response2.AddInt32(0); response2.AddInt32(0); Broadcast(ref response2); response2.Dispose(); return; } WS_PlayerData.CharacterObject looterCharacter = null; checked { int maxRoll = -1; foreach (KeyValuePair <WS_PlayerData.CharacterObject, int> looter in Looters) { if (looter.Value == maxRollType) { byte rollValue = (byte)WorldServiceLocator._WorldServer.Rnd.Next(0, 100); if (rollValue > maxRoll) { maxRoll = rollValue; looterCharacter = looter.Key; } Packets.PacketClass response = new(Opcodes.SMSG_LOOT_ROLL); response.AddUInt64(LootObject.GUID); response.AddInt32(LootSlot); response.AddUInt64(looter.Key.GUID); response.AddInt32(Item.ItemID); response.AddInt32(0); response.AddInt32(0); response.AddInt8(rollValue); response.AddInt8((byte)looter.Value); Broadcast(ref response); response.Dispose(); } } ItemObject itemObject = new(Item.ItemID, looterCharacter.GUID) { StackCount = Item.ItemCount }; ItemObject tmpItem = itemObject; Packets.PacketClass wonItem = new(Opcodes.SMSG_LOOT_ROLL_WON); wonItem.AddUInt64(LootObject.GUID); wonItem.AddInt32(LootSlot); wonItem.AddInt32(Item.ItemID); wonItem.AddInt32(0); wonItem.AddInt32(0); wonItem.AddUInt64(looterCharacter.GUID); wonItem.AddInt8((byte)maxRoll); wonItem.AddInt8(maxRollType); Broadcast(ref wonItem); if (looterCharacter.ItemADD(ref tmpItem)) { looterCharacter.LogLootItem(tmpItem, Item.ItemCount, Recieved: false, Created: false); LootObject.GroupLootInfo.Remove(LootSlot); LootObject.Items[LootSlot] = null; } else { tmpItem.Delete(); LootObject.GroupLootInfo.Remove(LootSlot); } } }