Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
200
Scripts/Services/HuntmasterChallenge/BestKillBoard.cs
Normal file
200
Scripts/Services/HuntmasterChallenge/BestKillBoard.cs
Normal file
@@ -0,0 +1,200 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.HuntsmasterChallenge;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class BestKillBoard : Item
|
||||
{
|
||||
public override string DefaultName { get { return "Top 10 Kill Board"; } }
|
||||
|
||||
[Constructable]
|
||||
public BestKillBoard() : base(7775)
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(this.Location, 3) && HuntingSystem.Instance != null && HuntingSystem.Instance.Active)
|
||||
{
|
||||
from.CloseGump(typeof(BestKillGump));
|
||||
from.SendGump(new BestKillGump());
|
||||
}
|
||||
}
|
||||
|
||||
public BestKillBoard(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
|
||||
private class BestKillGump : Gump
|
||||
{
|
||||
private int m_Filter;
|
||||
|
||||
public BestKillGump() : this(-1) { }
|
||||
|
||||
public BestKillGump(int filter) : base(20, 20)
|
||||
{
|
||||
if (HuntingSystem.Instance == null)
|
||||
return;
|
||||
|
||||
m_Filter = filter;
|
||||
|
||||
if (m_Filter < -1) m_Filter = 23;
|
||||
if (m_Filter > 23) m_Filter = -1;
|
||||
|
||||
List<HuntingKillEntry> useList = new List<HuntingKillEntry>();
|
||||
|
||||
if (m_Filter == -1)
|
||||
{
|
||||
foreach (KeyValuePair<HuntType, List<HuntingKillEntry>> kvp in HuntingSystem.Instance.Top10)
|
||||
{
|
||||
if(kvp.Value.Count > 0)
|
||||
useList.AddRange(kvp.Value);
|
||||
}
|
||||
}
|
||||
else if(HuntingSystem.Instance.Top10.ContainsKey((HuntType)m_Filter))
|
||||
{
|
||||
useList = HuntingSystem.Instance.Top10[(HuntType)m_Filter];
|
||||
}
|
||||
|
||||
AddBackground(0, 0, 500, 400, 9250);
|
||||
|
||||
AddHtml(0, 15, 500, 16, "<Center>Top 10 Kills</Center>", false, false);
|
||||
AddHtml(20, 40, 150, 16, "<Basefont Color=#A52A2A>Hunter</Basefont>", false, false);
|
||||
AddHtml(170, 40, 120, 16, "<Basefont Color=#A52A2A>Species</Basefont>", false, false);
|
||||
AddHtml(290, 40, 150, 16, "<Basefont Color=#A52A2A>Measurement</Basefont>", false, false);
|
||||
AddHtml(390, 40, 110, 16, "<Basefont Color=#A52A2A>Date Killed</Basefont>", false, false);
|
||||
|
||||
useList.Sort();
|
||||
int y = 80;
|
||||
|
||||
for (int i = 0; i < useList.Count && i < 10; i++)
|
||||
{
|
||||
HuntingKillEntry entry = useList[i];
|
||||
HuntingTrophyInfo info = HuntingTrophyInfo.Infos[entry.KillIndex];
|
||||
|
||||
AddHtml(20, y, 150, 16, entry.Owner != null ? FormatFont(entry.Owner.Name, i) : FormatFont("Unknown", i), false, false);
|
||||
AddHtml(170, y, 120, 16, FormatFont(GetHuntTypeString(info.HuntType), i), false, false);
|
||||
AddHtml(290, y, 100, 16, info.MeasuredBy == MeasuredBy.Weight ? FormatFont(entry.Measurement.ToString() + " stones", i) : FormatFont(entry.Measurement.ToString() + " feet", i), false, false);
|
||||
AddHtml(390, y, 150, 16, FormatFont(entry.DateKilled.ToShortDateString(), i), false, false);
|
||||
|
||||
y += 20;
|
||||
}
|
||||
|
||||
AddHtml(0, 365, 500, 16, String.Format("<Center>{0}</Center>", GetHuntTypeString()), false, false);
|
||||
|
||||
AddButton(150, 365, 4014, 4016, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(328, 365, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
}
|
||||
|
||||
private string FormatFont(string str, int index)
|
||||
{
|
||||
int hue = 080000 + (100000 * index);
|
||||
|
||||
return String.Format("<BaseFont Color=#{0}>{1}</basefont>", hue.ToString(), str);
|
||||
}
|
||||
|
||||
public override void OnResponse(Server.Network.NetState state, RelayInfo info)
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
m_Filter--;
|
||||
from.SendGump(new BestKillGump(m_Filter));
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
m_Filter++;
|
||||
from.SendGump(new BestKillGump(m_Filter));
|
||||
}
|
||||
}
|
||||
|
||||
private string GetHuntTypeString(HuntType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case HuntType.GrizzlyBear: return "Grizzly Bear";
|
||||
case HuntType.GrayWolf: return "Grey Wolf";
|
||||
case HuntType.Cougar: return "Cougar";
|
||||
case HuntType.Turkey: return "Turkey";
|
||||
case HuntType.Bull: return "Bull";
|
||||
case HuntType.Boar: return "Boar";
|
||||
case HuntType.Walrus: return "Walrus";
|
||||
case HuntType.Alligator: return "Alligator";
|
||||
case HuntType.Eagle: return "Eagle";
|
||||
//Publish 91 added:
|
||||
case HuntType.MyrmidexLarvae: return "Myrmidex Larvae";
|
||||
case HuntType.Najasaurus: return "Najasaurus";
|
||||
case HuntType.Anchisaur: return "Anchisaur";
|
||||
case HuntType.Allosaurus: return "Allosaurus";
|
||||
case HuntType.Dimetrosaur: return "Dimetrosaur";
|
||||
case HuntType.Saurosaurus: return "Saurosaurus";
|
||||
//Publish 95 added:
|
||||
case HuntType.Tiger: return "Tiger";
|
||||
case HuntType.MyrmidexDrone: return "Myrmidex Drone";
|
||||
case HuntType.Triceratops: return "Triceratops";
|
||||
case HuntType.Lion: return "Lion";
|
||||
case HuntType.WhiteTiger: return "White Tiger";
|
||||
case HuntType.BlackTiger: return "Black Tiger";
|
||||
//Publish 102 added:
|
||||
case HuntType.Raptor: return "Raptor";
|
||||
case HuntType.SeaSerpent: return "Sea Serpent";
|
||||
case HuntType.Scorpion: return "Scorpion";
|
||||
}
|
||||
}
|
||||
|
||||
private string GetHuntTypeString()
|
||||
{
|
||||
switch (m_Filter)
|
||||
{
|
||||
default: return "No Filter";
|
||||
case (int)HuntType.GrizzlyBear: return "Grizzly Bear";
|
||||
case (int)HuntType.GrayWolf: return "Grey Wolf";
|
||||
case (int)HuntType.Cougar: return "Cougar";
|
||||
case (int)HuntType.Turkey: return "Turkey";
|
||||
case (int)HuntType.Bull: return "Bull";
|
||||
case (int)HuntType.Boar: return "Boar";
|
||||
case (int)HuntType.Walrus: return "Walrus";
|
||||
case (int)HuntType.Alligator: return "Alligator";
|
||||
case (int)HuntType.Eagle: return "Eagle";
|
||||
//Publish 91 added:
|
||||
case (int)HuntType.MyrmidexLarvae: return "Myrmidex Larvae";
|
||||
case (int)HuntType.Najasaurus: return "Najasaurus";
|
||||
case (int)HuntType.Anchisaur: return "Anchisaur";
|
||||
case (int)HuntType.Allosaurus: return "Allosaurus";
|
||||
case (int)HuntType.Dimetrosaur: return "Dimetrosaur";
|
||||
case (int)HuntType.Saurosaurus: return "Saurosaurus";
|
||||
//Publish 95 added:
|
||||
case (int)HuntType.Tiger: return "Tiger";
|
||||
case (int)HuntType.MyrmidexDrone: return "Myrmidex Drone";
|
||||
case (int)HuntType.Triceratops: return "Triceratops";
|
||||
case (int)HuntType.Lion: return "Lion";
|
||||
case (int)HuntType.WhiteTiger: return "White Tiger";
|
||||
case (int)HuntType.BlackTiger: return "Black Tiger";
|
||||
//Publish 102 added:
|
||||
case (int)HuntType.Raptor: return "Raptor";
|
||||
case (int)HuntType.SeaSerpent: return "Sea Serpent";
|
||||
case (int)HuntType.Scorpion: return "Scorpion";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
393
Scripts/Services/HuntmasterChallenge/ComplexHuntTrophy.cs
Normal file
393
Scripts/Services/HuntmasterChallenge/ComplexHuntTrophy.cs
Normal file
@@ -0,0 +1,393 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.HuntsmasterChallenge;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[FlipableAddon(Direction.South, Direction.East)]
|
||||
public class HuntTrophyAddon : BaseAddon
|
||||
{
|
||||
private string m_Owner;
|
||||
private int m_Measurement;
|
||||
private string m_Location;
|
||||
private string m_DateKilled;
|
||||
private int m_Index;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Owner { get { return m_Owner; } set { m_Owner = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string KillLocation { get { return m_Location; } set { m_Location = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Measurement { get { return m_Measurement; } set { m_Measurement = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DateKilled { get { return m_DateKilled; } set { m_DateKilled = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TextDefinition Species { get { return Info.Species; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MeasuredBy MeasuredBy { get { return Info.MeasuredBy; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int EastID { get { return Info.EastID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int SouthID { get { return Info.SouthID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Index < 0 || m_Index >= HuntingTrophyInfo.Infos.Count)
|
||||
{
|
||||
m_Index = 4;
|
||||
}
|
||||
|
||||
return m_Index;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Index = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HuntingTrophyInfo Info { get { return HuntingTrophyInfo.Infos[Index]; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complex { get { return Info.Complex; } }
|
||||
|
||||
public override BaseAddonDeed Deed { get { return new HuntTrophyAddonDeed(m_Owner, Index, m_Measurement, m_DateKilled, m_Location); } }
|
||||
|
||||
public HuntTrophyAddon(string name, int index, int measurement, string killed, string location)
|
||||
{
|
||||
Index = index;
|
||||
|
||||
m_Owner = name;
|
||||
m_Location = location;
|
||||
m_DateKilled = killed;
|
||||
m_Measurement = measurement;
|
||||
|
||||
switch (MeasuredBy)
|
||||
{
|
||||
case MeasuredBy.Weight:
|
||||
Weight = measurement;
|
||||
break;
|
||||
case MeasuredBy.Length:
|
||||
case MeasuredBy.Wingspan:
|
||||
Weight = 5.0;
|
||||
break;
|
||||
}
|
||||
|
||||
AddComponent(new HuntTrophyComponent(SouthID), 0, 0, 0);
|
||||
|
||||
if (Complex)
|
||||
{
|
||||
AddComponent(new HuntTrophyComponent(SouthID + 1), 0, -1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Flip(Mobile from, Direction direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case Direction.East:
|
||||
AddComponent(new HuntTrophyComponent(SouthID), 0, 0, 0);
|
||||
|
||||
if (Complex)
|
||||
{
|
||||
AddComponent(new HuntTrophyComponent(SouthID + 1), 0, -1, 0);
|
||||
}
|
||||
break;
|
||||
case Direction.South:
|
||||
AddComponent(new HuntTrophyComponent(EastID), 0, 0, 0);
|
||||
|
||||
if (Complex)
|
||||
{
|
||||
AddComponent(new HuntTrophyComponent(EastID + 1), 1, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public class HuntTrophyComponent : AddonComponent
|
||||
{
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Info != null)
|
||||
{
|
||||
return Info.TrophyName.Number;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.LabelNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HuntingTrophyInfo Info
|
||||
{
|
||||
get
|
||||
{
|
||||
var addon = Addon as HuntTrophyAddon;
|
||||
|
||||
if (addon != null)
|
||||
{
|
||||
return addon.Info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public HuntTrophyComponent(int id)
|
||||
: base(id)
|
||||
{
|
||||
if (Info != null && !String.IsNullOrEmpty(Info.TrophyName.String))
|
||||
{
|
||||
Name = Info.TrophyName.String;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
HuntTrophyAddon addon = Addon as HuntTrophyAddon;
|
||||
|
||||
if (addon != null)
|
||||
{
|
||||
list.Add(1155708, addon.Owner != null ? addon.Owner : "Unknown"); // Hunter: ~1_NAME~
|
||||
list.Add(1155709, addon.DateKilled); // Date of Kill: ~1_DATE~
|
||||
|
||||
if (addon.KillLocation != null)
|
||||
list.Add(1061114, addon.KillLocation); // Location: ~1_val~
|
||||
|
||||
list.Add(1155718, addon.Species.ToString());
|
||||
|
||||
if (addon.MeasuredBy == MeasuredBy.Length)
|
||||
list.Add(1155711, addon.Measurement.ToString()); // Length: ~1_VAL~
|
||||
else if (addon.MeasuredBy == MeasuredBy.Wingspan)
|
||||
list.Add(1155710, addon.Measurement.ToString()); // Wingspan: ~1_VAL~
|
||||
else
|
||||
list.Add(1072225, addon.Measurement.ToString()); // Weight: ~1_WEIGHT~ stones
|
||||
}
|
||||
}
|
||||
|
||||
public HuntTrophyComponent(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public HuntTrophyAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
|
||||
writer.Write(m_Index);
|
||||
writer.Write(m_Owner);
|
||||
writer.Write(m_Measurement);
|
||||
writer.Write(m_DateKilled);
|
||||
writer.Write(m_Location);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
switch (v)
|
||||
{
|
||||
case 1:
|
||||
m_Index = reader.ReadInt();
|
||||
m_Owner = reader.ReadString();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadString();
|
||||
m_Location = reader.ReadString();
|
||||
break;
|
||||
case 0:
|
||||
m_Owner = reader.ReadString();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadString();
|
||||
m_Location = reader.ReadString();
|
||||
var td = TextDefinition.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
reader.ReadInt();
|
||||
|
||||
Timer.DelayCall(() =>
|
||||
{
|
||||
Index = HuntingTrophyInfo.CheckInfo(td.Number);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HuntTrophyAddonDeed : BaseAddonDeed
|
||||
{
|
||||
public override int LabelNumber { get { return 1084024 + SouthID; } }
|
||||
|
||||
public override BaseAddon Addon { get { return new HuntTrophyAddon(m_Owner, Index, m_Measurement, m_DateKilled, m_Location); } }
|
||||
|
||||
private string m_Owner;
|
||||
private int m_Measurement;
|
||||
private string m_Location;
|
||||
private string m_DateKilled;
|
||||
private int m_Index;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Owner { get { return m_Owner; } set { m_Owner = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string KillLocation { get { return m_Location; } set { m_Location = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Measurement { get { return m_Measurement; } set { m_Measurement = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DateKilled { get { return m_DateKilled; } set { m_DateKilled = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TextDefinition Species { get { return Info.Species; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TextDefinition TrophyName { get { return Info.TrophyName; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MeasuredBy MeasuredBy { get { return Info.MeasuredBy; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int EastID { get { return Info.EastID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int SouthID { get { return Info.SouthID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complex { get { return Info.Complex; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Index < 0 || m_Index >= HuntingTrophyInfo.Infos.Count)
|
||||
{
|
||||
m_Index = 4;
|
||||
}
|
||||
|
||||
return m_Index;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Index = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HuntingTrophyInfo Info { get { return HuntingTrophyInfo.Infos[Index]; } }
|
||||
|
||||
public HuntTrophyAddonDeed(string name, int index, int measurement, string killed, string location)
|
||||
{
|
||||
Index = index;
|
||||
|
||||
m_Owner = name;
|
||||
m_Location = location;
|
||||
m_DateKilled = killed;
|
||||
m_Measurement = measurement;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1155708, m_Owner != null ? m_Owner : "Unknown"); // Hunter: ~1_NAME~
|
||||
list.Add(1155709, DateKilled); // Date of Kill: ~1_DATE~
|
||||
|
||||
if (m_Location != null)
|
||||
list.Add(1061114, m_Location); // Location: ~1_val~
|
||||
|
||||
list.Add(1155718, Species.ToString());
|
||||
|
||||
if (MeasuredBy == MeasuredBy.Length)
|
||||
list.Add(1155711, m_Measurement.ToString()); // Length: ~1_VAL~
|
||||
else if (MeasuredBy == MeasuredBy.Wingspan)
|
||||
list.Add(1155710, m_Measurement.ToString()); // Wingspan: ~1_VAL~
|
||||
else
|
||||
list.Add(1072225, m_Measurement.ToString()); // Weight: ~1_WEIGHT~ stones
|
||||
}
|
||||
|
||||
public HuntTrophyAddonDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
|
||||
writer.Write(m_Index);
|
||||
writer.Write(m_Owner);
|
||||
writer.Write(m_Measurement);
|
||||
writer.Write(m_DateKilled);
|
||||
writer.Write(m_Location);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
switch (v)
|
||||
{
|
||||
case 1:
|
||||
m_Index = reader.ReadInt();
|
||||
m_Owner = reader.ReadString();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadString();
|
||||
m_Location = reader.ReadString();
|
||||
break;
|
||||
case 0:
|
||||
m_Owner = reader.ReadString();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadString();
|
||||
m_Location = reader.ReadString();
|
||||
var td = TextDefinition.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
reader.ReadInt();
|
||||
|
||||
Timer.DelayCall(() =>
|
||||
{
|
||||
Index = HuntingTrophyInfo.CheckInfo(td.Number);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
146
Scripts/Services/HuntmasterChallenge/DisplayTrophy.cs
Normal file
146
Scripts/Services/HuntmasterChallenge/DisplayTrophy.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.HuntsmasterChallenge;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HuntingDisplayTrophy : Item
|
||||
{
|
||||
private HuntType m_HuntType;
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
HuntingTrophyInfo info = HuntingTrophyInfo.GetInfo(m_HuntType);
|
||||
|
||||
if (info != null && info.Species.Number > 0)
|
||||
return info.Species.Number;
|
||||
|
||||
return 1084024 + ItemID;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HuntType HuntType
|
||||
{
|
||||
get { return m_HuntType; }
|
||||
set
|
||||
{
|
||||
m_HuntType = value;
|
||||
InvalidateType();
|
||||
}
|
||||
}
|
||||
|
||||
public void InvalidateType()
|
||||
{
|
||||
HuntingTrophyInfo info = HuntingTrophyInfo.GetInfo(m_HuntType);
|
||||
|
||||
if (info != null)
|
||||
ItemID = info.SouthID;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public HuntingDisplayTrophy() : this(HuntType.GrizzlyBear)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public HuntingDisplayTrophy(HuntType type)
|
||||
{
|
||||
HuntType = type;
|
||||
Movable = false;
|
||||
|
||||
m_DisplayTrophies.Add(this);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (HuntingSystem.Instance == null)
|
||||
return;
|
||||
|
||||
if (!HuntingSystem.Instance.Leaders.ContainsKey(m_HuntType))
|
||||
HuntingSystem.Instance.Leaders[m_HuntType] = new List<HuntingKillEntry>();
|
||||
|
||||
List<HuntingKillEntry> entries = HuntingSystem.Instance.Leaders[m_HuntType];
|
||||
HuntingKillEntry entry = null;
|
||||
|
||||
if (entries.Count > 0)
|
||||
entry = entries[0];
|
||||
|
||||
if (entry != null)
|
||||
{
|
||||
HuntingTrophyInfo info = HuntingTrophyInfo.GetInfo(m_HuntType);
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
list.Add(1155708, entry.Owner != null ? entry.Owner.Name : "Unknown"); // Hunter: ~1_NAME~
|
||||
list.Add(1155709, entry.DateKilled.ToShortDateString()); // Date of Kill: ~1_DATE~
|
||||
|
||||
if (entry.Location != null)
|
||||
list.Add(1061114, entry.Location); // Location: ~1_val~
|
||||
|
||||
list.Add(1155718, info.Species.ToString());
|
||||
|
||||
if (info.MeasuredBy == MeasuredBy.Length)
|
||||
list.Add(1155711, entry.Measurement.ToString()); // Length: ~1_VAL~
|
||||
else if (info.MeasuredBy == MeasuredBy.Wingspan)
|
||||
list.Add(1155710, entry.Measurement.ToString()); // Wingspan: ~1_VAL~
|
||||
else
|
||||
list.Add(1072789, entry.Measurement.ToString()); // Weight: ~1_WEIGHT~
|
||||
}
|
||||
}
|
||||
|
||||
if (HuntingSystem.Instance != null && HuntingSystem.Instance.Active)
|
||||
list.Add("Season Ends: {0}", HuntingSystem.Instance.SeasonEnds.ToShortDateString());
|
||||
}
|
||||
|
||||
private static List<HuntingDisplayTrophy> m_DisplayTrophies = new List<HuntingDisplayTrophy>();
|
||||
|
||||
public static void InvalidateDisplayTrophies()
|
||||
{
|
||||
foreach (HuntingDisplayTrophy trophy in m_DisplayTrophies)
|
||||
{
|
||||
if(trophy != null && !trophy.Deleted)
|
||||
trophy.InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
if (m_DisplayTrophies.Contains(this))
|
||||
m_DisplayTrophies.Remove(this);
|
||||
|
||||
base.Delete();
|
||||
}
|
||||
|
||||
public HuntingDisplayTrophy(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write((int)m_HuntType);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
m_HuntType = (HuntType)reader.ReadInt();
|
||||
|
||||
m_DisplayTrophies.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
168
Scripts/Services/HuntmasterChallenge/HuntMaster.cs
Normal file
168
Scripts/Services/HuntmasterChallenge/HuntMaster.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.HuntsmasterChallenge
|
||||
{
|
||||
public class HuntMaster : BaseVendor
|
||||
{
|
||||
private List<SBInfo> m_SBInfos = new List<SBInfo>();
|
||||
protected override List<SBInfo> SBInfos { get { return m_SBInfos; } }
|
||||
public override bool IsActiveVendor { get { return false; } }
|
||||
|
||||
public override void InitSBInfo()
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public HuntMaster() : base ( "the huntmaster" )
|
||||
{
|
||||
SpeechHue = 0x3B2;
|
||||
|
||||
CheckItems();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(this.Location, 4))
|
||||
{
|
||||
from.CloseGump(typeof(BasicInfoGump));
|
||||
from.SendGump(new BasicInfoGump(1155750, 1155726));
|
||||
|
||||
/*Greetings! Only the most brave Hunters dare take my challenge! To participate,
|
||||
simply purchase a hunting permit from me for 5,000gp. When you are ready to to
|
||||
hunt seek any species of prey represented by the trophies in this hall. When you
|
||||
have bested your quarry use the deed on the corpse to document your kill. Return
|
||||
to me and hand me the permit and I will process it. If your kill beats or ties the
|
||||
current best record for that species, you will be eligible for rewards when the
|
||||
contest finishes on the first day of the next month! Return and speak to me on
|
||||
the first day of the next month to claim your rewards should your record hold up
|
||||
during the month long contest! You may also use a taxidermy kit, purchasable from a
|
||||
tanner, to create a trophy of your kill like the ones you see here. Happy Hunting!*/
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddCustomContextEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
if(from is PlayerMobile && HuntingSystem.Instance != null && HuntingSystem.Instance.Active)
|
||||
{
|
||||
list.Add(new BuyPermitEntry(this));
|
||||
list.Add(new ClaimEntry((PlayerMobile)from, this));
|
||||
}
|
||||
|
||||
base.AddCustomContextEntries(from, list);
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if(dropped is HuntingPermit)
|
||||
{
|
||||
HuntingPermit permit = dropped as HuntingPermit;
|
||||
HuntingSystem sys = HuntingSystem.Instance;
|
||||
|
||||
if(sys == null || !sys.Active)
|
||||
return false;
|
||||
|
||||
if(!permit.HasDocumentedKill)
|
||||
SayTo(from, "You can't submit a kill you haven't documented yet!");
|
||||
else if (permit.KillEntry.DateKilled < sys.SeasonBegins)
|
||||
SayTo(from, 1155720); // This permit was documented in a different month or year than the current month and year. I only accept permits documented in the current month and year.
|
||||
else if (permit.HasSubmitted)
|
||||
SayTo(from, 1155719); // This permit has already been submitted.
|
||||
else
|
||||
sys.TrySubmitKill(this, from, permit);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private class BuyPermitEntry : ContextMenuEntry
|
||||
{
|
||||
private HuntMaster m_HuntMaster;
|
||||
|
||||
public BuyPermitEntry(HuntMaster master) : base(1155701, 3) // Get Hunting Permit
|
||||
{
|
||||
m_HuntMaster = master;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
Mobile from = this.Owner.From;
|
||||
|
||||
if(HuntingPermit.HasPermit(from))
|
||||
from.SendLocalizedMessage(1155702); // You already have a hunting permit.
|
||||
else if(Banker.Withdraw(from, 5000, true))
|
||||
{
|
||||
HuntingPermit permit = new HuntingPermit(from);
|
||||
|
||||
if(from.Backpack == null || !from.Backpack.TryDropItem(from, permit, false))
|
||||
{
|
||||
from.SendLocalizedMessage(1155703); // Your backpack was too full so the permit was deleted. Empty your backpack and try again.
|
||||
permit.Delete();
|
||||
}
|
||||
//TODO: Message???
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(500382); // Thou dost not have sufficient funds in thy account to withdraw that much.
|
||||
}
|
||||
}
|
||||
|
||||
private class ClaimEntry : ContextMenuEntry
|
||||
{
|
||||
private PlayerMobile m_Mobile;
|
||||
private Mobile m_Vendor;
|
||||
|
||||
public ClaimEntry(PlayerMobile mobile, Mobile vendor)
|
||||
: base(1155593, 2)
|
||||
{
|
||||
m_Mobile = mobile;
|
||||
m_Vendor = vendor;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
m_Mobile.SendGump(new HuntmasterRewardGump(m_Vendor, m_Mobile));
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckItems()
|
||||
{
|
||||
if (Backpack == null)
|
||||
AddItem(new Backpack());
|
||||
|
||||
Item i = Backpack.FindItemByType(typeof(HuntmastersRewardTitleDeed));
|
||||
if (i == null)
|
||||
Backpack.DropItem(new HuntmastersRewardTitleDeed());
|
||||
|
||||
i = Backpack.FindItemByType(typeof(RangersGuildSash));
|
||||
if (i == null)
|
||||
Backpack.DropItem(new RangersGuildSash());
|
||||
|
||||
i = Backpack.FindItemByType(typeof(GargishRangersGuildSash));
|
||||
if (i == null)
|
||||
Backpack.DropItem(new GargishRangersGuildSash());
|
||||
}
|
||||
|
||||
public HuntMaster(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(10), CheckItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
109
Scripts/Services/HuntmasterChallenge/HuntMasterRewardGump.cs
Normal file
109
Scripts/Services/HuntmasterChallenge/HuntMasterRewardGump.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.HuntsmasterChallenge
|
||||
{
|
||||
public class HuntmasterRewardGump : BaseRewardGump
|
||||
{
|
||||
public HuntmasterRewardGump(Mobile huntmaster, PlayerMobile pm)
|
||||
: base(huntmaster, pm, _Collections, 1155726) // Huntmaster's Challenge
|
||||
{
|
||||
}
|
||||
|
||||
public override double GetPoints(Mobile m)
|
||||
{
|
||||
if (HuntingSystem.Instance == null)
|
||||
return 0.0;
|
||||
|
||||
var sys = HuntingSystem.Instance;
|
||||
|
||||
if (sys.UnclaimedWinners.ContainsKey(m))
|
||||
{
|
||||
if (sys.UnclaimedWinners[User] <= 0)
|
||||
{
|
||||
sys.UnclaimedWinners.Remove(User);
|
||||
}
|
||||
else
|
||||
{
|
||||
return sys.UnclaimedWinners[m];
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
public override void RemovePoints(double points)
|
||||
{
|
||||
if (HuntingSystem.Instance == null)
|
||||
return;
|
||||
|
||||
var sys = HuntingSystem.Instance;
|
||||
|
||||
if (sys.UnclaimedWinners.ContainsKey(User))
|
||||
{
|
||||
sys.UnclaimedWinners[User]--;
|
||||
|
||||
if (sys.UnclaimedWinners[User] <= 0)
|
||||
{
|
||||
sys.UnclaimedWinners.Remove(User);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnConfirmed(CollectionItem citem, int index)
|
||||
{
|
||||
if (citem.Type == typeof(RecipeScroll))
|
||||
{
|
||||
Item item;
|
||||
|
||||
switch (citem.Tooltip)
|
||||
{
|
||||
default:
|
||||
case 1158769: item = new RecipeScroll(605); break;
|
||||
case 1158770: item = new RecipeScroll(606); break;
|
||||
case 1158771: item = new RecipeScroll(607); break;
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (User.Backpack == null || !User.Backpack.TryDropItem(User, item, false))
|
||||
{
|
||||
User.SendLocalizedMessage(1074361); // The reward could not be given. Make sure you have room in your pack.
|
||||
item.Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnItemCreated(item);
|
||||
|
||||
User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
|
||||
RemovePoints(citem.Points);
|
||||
User.PlaySound(0x5A8);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnConfirmed(citem, index);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<CollectionItem> _Collections = new List<CollectionItem>
|
||||
{
|
||||
new CollectionItem(typeof(HarvestersBlade), 0x2D20, 1114096, 0, 1.0),
|
||||
new CollectionItem(typeof(HornOfPlenty), 18080, 1153503, 0, 1.0),
|
||||
new CollectionItem(typeof(HuntmastersRewardTitleDeed), 0x14EF, 0, 0, 1.0),
|
||||
new CollectionItem(typeof(RangersGuildSash), 0x1541, 0, 0, 1.0),
|
||||
new CollectionItem(typeof(GargishRangersGuildSash), 0x46B5, 0, 0, 1.0),
|
||||
new CollectionItem(typeof(RecipeScroll), 0x2831, 1158769, 0, 1.0), // hamburger recipe
|
||||
new CollectionItem(typeof(RecipeScroll), 0x2831, 1158770, 0, 1.0), // hot dog recipe
|
||||
new CollectionItem(typeof(RecipeScroll), 0x2831, 1158771, 0, 1.0), // sausage recipe
|
||||
new CollectionItem(typeof(MinersSatchel), 0xA272, 1158773, 0, 1.0),
|
||||
new CollectionItem(typeof(LumbjacksSatchel), 0xA274, 1158772, 0, 1.0),
|
||||
new CollectionItem(typeof(HarvestersAxe), 0x1443, 1158774, 0, 1.0),
|
||||
};
|
||||
}
|
||||
}
|
||||
413
Scripts/Services/HuntmasterChallenge/HuntTrophy.cs
Normal file
413
Scripts/Services/HuntmasterChallenge/HuntTrophy.cs
Normal file
@@ -0,0 +1,413 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Server;
|
||||
using Server.Multis;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.HuntsmasterChallenge;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HuntTrophy : Item, IFlipable
|
||||
{
|
||||
private string m_Owner;
|
||||
private int m_Measurement;
|
||||
private string m_Location;
|
||||
private string m_DateKilled;
|
||||
private int m_Index;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Owner { get { return m_Owner; } set { m_Owner = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string KillLocation { get { return m_Location; } set { m_Location = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Measurement { get { return m_Measurement; } set { m_Measurement = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DateKilled { get { return m_DateKilled; } set { m_DateKilled = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TextDefinition Species { get { return Info.Species; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MeasuredBy MeasuredBy { get { return Info.MeasuredBy; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int EastID { get { return Info.EastID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int SouthID { get { return Info.SouthID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Index < 0 || m_Index >= HuntingTrophyInfo.Infos.Count)
|
||||
{
|
||||
m_Index = 4;
|
||||
}
|
||||
|
||||
return m_Index;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Index = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HuntingTrophyInfo Info { get { return HuntingTrophyInfo.Infos[Index]; } }
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
return Info.TrophyName.Number;
|
||||
}
|
||||
}
|
||||
|
||||
public HuntTrophy(string name, int index, int measurement, string killed, string location)
|
||||
{
|
||||
Index = index;
|
||||
ItemID = Info.SouthID;
|
||||
|
||||
m_Owner = name;
|
||||
m_Location = location;
|
||||
m_DateKilled = killed;
|
||||
m_Measurement = measurement;
|
||||
|
||||
if (!String.IsNullOrEmpty(Info.TrophyName.String))
|
||||
{
|
||||
Name = Info.TrophyName.String;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnFlip(Mobile m)
|
||||
{
|
||||
if (ItemID == Info.SouthID)
|
||||
{
|
||||
ItemID = Info.EastID;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemID = Info.SouthID;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1155708, m_Owner != null ? m_Owner : "Unknown"); // Hunter: ~1_NAME~
|
||||
list.Add(1155709, m_DateKilled); // Date of Kill: ~1_DATE~
|
||||
|
||||
if(m_Location != null)
|
||||
list.Add(1061114, m_Location); // Location: ~1_val~
|
||||
|
||||
list.Add(1155718, Species.ToString());
|
||||
|
||||
if (MeasuredBy == MeasuredBy.Length)
|
||||
list.Add(1155711, m_Measurement.ToString()); // Length: ~1_VAL~
|
||||
else if (MeasuredBy == MeasuredBy.Wingspan)
|
||||
list.Add(1155710, m_Measurement.ToString()); // Wingspan: ~1_VAL~
|
||||
else
|
||||
list.Add(1072225, m_Measurement.ToString()); // Weight: ~1_WEIGHT~ stones
|
||||
|
||||
}
|
||||
|
||||
public HuntTrophy(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)2);
|
||||
|
||||
writer.Write(m_Index);
|
||||
writer.Write(m_Owner);
|
||||
writer.Write(m_Measurement);
|
||||
writer.Write(m_DateKilled);
|
||||
writer.Write(m_Location);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
switch (v)
|
||||
{
|
||||
case 2:
|
||||
m_Index = reader.ReadInt();
|
||||
m_Owner = reader.ReadString();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadString();
|
||||
m_Location = reader.ReadString();
|
||||
break;
|
||||
case 1:
|
||||
reader.ReadBool();
|
||||
m_Owner = reader.ReadString();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadString();
|
||||
m_Location = reader.ReadString();
|
||||
var td = TextDefinition.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
reader.ReadInt();
|
||||
|
||||
Timer.DelayCall(() =>
|
||||
{
|
||||
Index = HuntingTrophyInfo.CheckInfo(td.Number);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HuntTrophyDeed : Item
|
||||
{
|
||||
private string m_Owner;
|
||||
private int m_Measurement;
|
||||
private string m_Location;
|
||||
private string m_DateKilled;
|
||||
private int m_Index;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Owner { get { return m_Owner; } set { m_Owner = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string KillLocation { get { return m_Location; } set { m_Location = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Measurement { get { return m_Measurement; } set { m_Measurement = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string DateKilled { get { return m_DateKilled; } set { m_DateKilled = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TextDefinition Species { get { return Info.Species; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MeasuredBy MeasuredBy { get { return Info.MeasuredBy; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int EastID { get { return Info.EastID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int SouthID { get { return Info.SouthID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Index < 0 || m_Index >= HuntingTrophyInfo.Infos.Count)
|
||||
{
|
||||
m_Index = 4;
|
||||
}
|
||||
|
||||
return m_Index;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Index = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HuntingTrophyInfo Info { get { return HuntingTrophyInfo.Infos[Index]; } }
|
||||
|
||||
public override int LabelNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Species.Number > 0)
|
||||
return Species.Number;
|
||||
|
||||
return 1084024 + ItemID;
|
||||
}
|
||||
}
|
||||
|
||||
public HuntTrophyDeed(string from, int index, int measurement, string killed, string location)
|
||||
: base(5359)
|
||||
{
|
||||
Index = index;
|
||||
|
||||
m_Owner = from;
|
||||
m_Location = location;
|
||||
m_DateKilled = killed;
|
||||
m_Measurement = measurement;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsChildOf(from.Backpack))
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(from);
|
||||
|
||||
if (house != null && house.IsCoOwner(from))
|
||||
{
|
||||
bool northWall = BaseAddon.IsWall(from.X, from.Y - 1, from.Z, from.Map);
|
||||
bool westWall = BaseAddon.IsWall(from.X - 1, from.Y, from.Z, from.Map);
|
||||
|
||||
if (northWall && westWall)
|
||||
{
|
||||
switch (from.Direction & Direction.Mask)
|
||||
{
|
||||
case Direction.North:
|
||||
case Direction.South: northWall = true; westWall = false; break;
|
||||
|
||||
case Direction.East:
|
||||
case Direction.West: northWall = false; westWall = true; break;
|
||||
|
||||
default: from.SendMessage("Turn to face the wall on which to hang this trophy."); return;
|
||||
}
|
||||
}
|
||||
|
||||
int itemID = 0;
|
||||
|
||||
if (northWall)
|
||||
itemID = SouthID;
|
||||
else if (westWall)
|
||||
itemID = EastID;
|
||||
else
|
||||
from.SendLocalizedMessage(1042626); // The trophy must be placed next to a wall.
|
||||
|
||||
if (itemID > 0)
|
||||
{
|
||||
Item trophy;
|
||||
|
||||
if (Info.Complex)
|
||||
{
|
||||
trophy = new HuntTrophyAddon(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
trophy = new HuntTrophy(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
|
||||
trophy.ItemID = itemID;
|
||||
}
|
||||
|
||||
trophy.MoveToWorld(from.Location, from.Map);
|
||||
|
||||
house.Addons[trophy] = from;
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502092); // You must be in your house to do this.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add(1155708, m_Owner != null ? m_Owner : "Unknown"); // Hunter: ~1_NAME~
|
||||
list.Add(1155709, m_DateKilled); // Date of Kill: ~1_DATE~
|
||||
|
||||
if (m_Location != null)
|
||||
list.Add(1061114, m_Location); // Location: ~1_val~
|
||||
|
||||
list.Add(1155718, Species.ToString());
|
||||
|
||||
if (MeasuredBy == MeasuredBy.Length)
|
||||
list.Add(1155711, Measurement.ToString()); // Length: ~1_VAL~
|
||||
else if (MeasuredBy == MeasuredBy.Wingspan)
|
||||
list.Add(1155710, Measurement.ToString()); // Wingspan: ~1_VAL~
|
||||
else
|
||||
list.Add(1072225, Measurement.ToString()); // Weight: ~1_WEIGHT~ stones
|
||||
}
|
||||
|
||||
public HuntTrophyDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)2);
|
||||
|
||||
writer.Write(m_Index);
|
||||
writer.Write(m_Owner);
|
||||
writer.Write(m_Measurement);
|
||||
writer.Write(m_DateKilled);
|
||||
writer.Write(m_Location);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
switch (v)
|
||||
{
|
||||
case 2:
|
||||
m_Index = reader.ReadInt();
|
||||
m_Owner = reader.ReadString();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadString();
|
||||
m_Location = reader.ReadString();
|
||||
break;
|
||||
case 1:
|
||||
reader.ReadBool();
|
||||
m_Owner = reader.ReadString();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadString();
|
||||
m_Location = reader.ReadString();
|
||||
var td = TextDefinition.Deserialize(reader);
|
||||
reader.ReadInt();
|
||||
reader.ReadInt();
|
||||
|
||||
Timer.DelayCall(() =>
|
||||
{
|
||||
Index = HuntingTrophyInfo.CheckInfo(td.Number);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(30), Replace);
|
||||
}
|
||||
|
||||
private void Replace()
|
||||
{
|
||||
var trophy = new HuntTrophy(m_Owner, Index, m_Measurement, m_DateKilled, m_Location);
|
||||
|
||||
if (Parent is Container)
|
||||
{
|
||||
((Container)Parent).DropItem(trophy);
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
trophy.MoveToWorld(GetWorldLocation(), Map);
|
||||
|
||||
trophy.IsLockedDown = IsLockedDown;
|
||||
trophy.IsSecure = IsSecure;
|
||||
trophy.Movable = Movable;
|
||||
|
||||
if (house != null && house.LockDowns.ContainsKey(this))
|
||||
{
|
||||
house.LockDowns.Remove(this);
|
||||
house.LockDowns.Add(trophy, house.Owner);
|
||||
}
|
||||
else if (house != null && house.IsSecure(this))
|
||||
{
|
||||
house.ReleaseSecure(house.Owner, this);
|
||||
house.AddSecure(house.Owner, trophy);
|
||||
}
|
||||
}
|
||||
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
241
Scripts/Services/HuntmasterChallenge/HuntingPermit.cs
Normal file
241
Scripts/Services/HuntmasterChallenge/HuntingPermit.cs
Normal file
@@ -0,0 +1,241 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.HuntsmasterChallenge;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HuntingPermit : Item
|
||||
{
|
||||
private static List<HuntingPermit> m_Permits = new List<HuntingPermit>();
|
||||
public static List<HuntingPermit> Permits { get { return m_Permits; } }
|
||||
|
||||
private Mobile m_Owner;
|
||||
private bool m_ProducedTrophy;
|
||||
private bool m_HasSubmitted;
|
||||
private HuntingKillEntry m_KillEntry;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Owner { get { return m_Owner; } set { m_Owner = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool ProducedTrophy { get { return m_ProducedTrophy; } set { m_ProducedTrophy = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HuntingKillEntry KillEntry { get { return m_KillEntry; } set { m_KillEntry = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool HasDocumentedKill { get { return m_KillEntry != null; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool CanUseTaxidermyOn { get { return HasDocumentedKill && m_KillEntry.KillIndex < HuntingTrophyInfo.Infos.Count && !m_ProducedTrophy; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool HasSubmitted
|
||||
{
|
||||
get { return m_HasSubmitted; }
|
||||
set
|
||||
{
|
||||
m_HasSubmitted = value;
|
||||
|
||||
if(m_HasSubmitted && m_Permits.Contains(this))
|
||||
m_Permits.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
public override int LabelNumber { get { return 1155704; } } // Hunting Permit
|
||||
|
||||
[Constructable]
|
||||
public HuntingPermit(Mobile from)
|
||||
: base(5360)
|
||||
{
|
||||
m_Owner = from;
|
||||
m_Permits.Add(this);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.Backpack != null && IsChildOf(from.Backpack))
|
||||
{
|
||||
if (!HasDocumentedKill)
|
||||
{
|
||||
from.Target = new InternalTarget(this);
|
||||
MessageHelper.SendLocalizedMessageTo(this, from, 1155705, 0x45); // Target the kill you wish to document
|
||||
}
|
||||
else
|
||||
from.SendLocalizedMessage(1155712); // This hunting permit has already documented a kill.
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (m_KillEntry == null || m_KillEntry.KillIndex < 0 || m_KillEntry.KillIndex >= HuntingTrophyInfo.Infos.Count)
|
||||
return;
|
||||
|
||||
HuntingTrophyInfo info = HuntingTrophyInfo.Infos[m_KillEntry.KillIndex];
|
||||
|
||||
if (m_Owner != null)
|
||||
list.Add(1155708, m_Owner.Name); // Hunter: ~1_NAME~
|
||||
|
||||
if (m_KillEntry.DateKilled != DateTime.MinValue)
|
||||
list.Add(1155709, m_KillEntry.DateKilled.ToShortDateString()); // Date of Kill: ~1_DATE~
|
||||
|
||||
if (m_KillEntry.Location != null)
|
||||
list.Add(1061114, m_KillEntry.Location); // Location: ~1_val~
|
||||
|
||||
list.Add(1155718, info.Species.ToString());
|
||||
|
||||
if (info.MeasuredBy == MeasuredBy.Length)
|
||||
list.Add(1155711, m_KillEntry.Measurement.ToString()); // Length: ~1_VAL~
|
||||
else if (info.MeasuredBy == MeasuredBy.Wingspan)
|
||||
list.Add(1155710, m_KillEntry.Measurement.ToString()); // Wingspan: ~1_VAL~
|
||||
else
|
||||
list.Add(1072789, m_KillEntry.Measurement.ToString()); // Weight: ~1_WEIGHT~
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private HuntingPermit m_Permit;
|
||||
|
||||
public InternalTarget(HuntingPermit Permit)
|
||||
: base(-1, false, TargetFlags.None)
|
||||
{
|
||||
m_Permit = Permit;
|
||||
}
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is Corpse)
|
||||
{
|
||||
Corpse c = targeted as Corpse;
|
||||
|
||||
if (!from.InRange(c.Location, 3))
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
if (c.VisitedByTaxidermist)
|
||||
from.SendLocalizedMessage(1042596); // That corpse seems to have been visited by a taxidermist already.
|
||||
else if (!m_Permit.IsChildOf(from.Backpack))
|
||||
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
|
||||
else if (c.Owner == null)
|
||||
from.SendLocalizedMessage(1155706); // That is not a valid kill.
|
||||
else if (!IsOnlyAttacker(from, c.Owner))
|
||||
from.SendLocalizedMessage(1155707); // You cannot document someone else's kill.
|
||||
else
|
||||
{
|
||||
Type t = c.Owner.GetType();
|
||||
|
||||
if (t == typeof(RagingGrizzlyBear)) // Bandaid Fix, we'll keep this until others arise
|
||||
t = typeof(GrizzlyBear);
|
||||
|
||||
for (int i = 0; i < HuntingTrophyInfo.Infos.Count; i++)
|
||||
{
|
||||
HuntingTrophyInfo info = HuntingTrophyInfo.Infos[i];
|
||||
|
||||
if (t == info.CreatureType)
|
||||
{
|
||||
int v = 0;
|
||||
|
||||
if (HuntingSystem.Instance != null && HuntingSystem.Instance.IsPrimeHunt(from, c.Location))
|
||||
{
|
||||
v = Utility.RandomMinMax(0, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
v = Utility.RandomMinMax(0, 10000);
|
||||
v = (int)Math.Sqrt(v);
|
||||
v = 100 - v;
|
||||
}
|
||||
|
||||
int measurement = info.MinMeasurement + (int)((double)(info.MaxMeasurement - info.MinMeasurement) * (double)((double)v / 100.0));
|
||||
m_Permit.KillEntry = new HuntingKillEntry(m_Permit.Owner, measurement, DateTime.Now, i, WorldLocationInfo.GetLocationString(c.Location, c.Map));
|
||||
c.VisitedByTaxidermist = true;
|
||||
|
||||
from.PlaySound(0x249);
|
||||
from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x45, 1155713, from.NetState); // *You document your kill on the permit*
|
||||
m_Permit.InvalidateProperties();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage(1155706); // That is not a valid kill.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsOnlyAttacker(Mobile from, Mobile creature)
|
||||
{
|
||||
BaseCreature bc = creature as BaseCreature;
|
||||
|
||||
if (bc != null)
|
||||
{
|
||||
List<DamageStore> rights = bc.GetLootingRights();
|
||||
|
||||
return rights.Count > 0 && rights[0].m_Mobile == from && rights[0].m_Damage >= bc.HitsMax;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
base.Delete();
|
||||
|
||||
if (m_Permits.Contains(this))
|
||||
m_Permits.Remove(this);
|
||||
}
|
||||
|
||||
public static bool HasPermit(Mobile from)
|
||||
{
|
||||
foreach (HuntingPermit permit in m_Permits)
|
||||
{
|
||||
if (permit.Owner == from)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public HuntingPermit(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write(m_Owner);
|
||||
writer.Write(m_ProducedTrophy);
|
||||
writer.Write(m_HasSubmitted);
|
||||
|
||||
if (m_KillEntry != null)
|
||||
{
|
||||
writer.Write((int)1);
|
||||
m_KillEntry.Serialize(writer);
|
||||
}
|
||||
else
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
m_Owner = reader.ReadMobile();
|
||||
m_ProducedTrophy = reader.ReadBool();
|
||||
m_HasSubmitted = reader.ReadBool();
|
||||
|
||||
if (reader.ReadInt() == 1)
|
||||
m_KillEntry = new HuntingKillEntry(reader);
|
||||
|
||||
if (m_Owner != null && !m_HasSubmitted)
|
||||
m_Permits.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
625
Scripts/Services/HuntmasterChallenge/HuntingSystem.cs
Normal file
625
Scripts/Services/HuntmasterChallenge/HuntingSystem.cs
Normal file
@@ -0,0 +1,625 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.Items;
|
||||
using Server.Gumps;
|
||||
using Server.Engines.Quests;
|
||||
|
||||
namespace Server.Engines.HuntsmasterChallenge
|
||||
{
|
||||
public class HuntingSystem : Item
|
||||
{
|
||||
private static HuntingSystem m_Instance;
|
||||
public static HuntingSystem Instance { get { return m_Instance; } }
|
||||
|
||||
private DateTime m_SeasonBegins;
|
||||
private DateTime m_SeasonEnds;
|
||||
private DateTime m_NextHint;
|
||||
private DateTime m_NextBonusIndex;
|
||||
private int m_BonusIndex;
|
||||
private bool m_Active;
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime SeasonBegins { get { return m_SeasonBegins; } set { m_SeasonBegins = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime SeasonEnds { get { return m_SeasonEnds; } set { m_SeasonEnds = value; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int BonusIndex { get { return m_BonusIndex; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Active { get { return m_Active; } set { m_Active = value; CheckTimer(); } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool NewSeason
|
||||
{
|
||||
get { return false; }
|
||||
set
|
||||
{
|
||||
EndSeason();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if(Core.SA && m_Instance == null)
|
||||
m_Instance = new HuntingSystem();
|
||||
}
|
||||
|
||||
public HuntingSystem() : base(17603)
|
||||
{
|
||||
if(m_Instance != null)
|
||||
{
|
||||
this.Delete();
|
||||
return;
|
||||
}
|
||||
|
||||
m_Instance = this;
|
||||
m_Active = true;
|
||||
|
||||
m_Top10 = new Dictionary<HuntType, List<HuntingKillEntry>>();
|
||||
m_Leaders = new Dictionary<HuntType, List<HuntingKillEntry>>();
|
||||
|
||||
m_SeasonBegins = DateTime.Now;
|
||||
DateTime ends = DateTime.Now + TimeSpan.FromDays(30);
|
||||
m_SeasonEnds = new DateTime(ends.Year, ends.Month, 1, 0, 0, 0);
|
||||
m_NextHint = DateTime.UtcNow;
|
||||
m_NextBonusIndex = DateTime.UtcNow;
|
||||
|
||||
CheckTimer();
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1), Setup);
|
||||
|
||||
Movable = false;
|
||||
Visible = false;
|
||||
Name = "Huntsmaster Challenge System";
|
||||
|
||||
MoveToWorld(new Point3D(744, 2136, 0), Map.Trammel);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile m)
|
||||
{
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
m.SendGump(new PropertiesGump(m, this));
|
||||
}
|
||||
|
||||
private void CheckTimer()
|
||||
{
|
||||
if (m_Active)
|
||||
{
|
||||
if (m_Timer != null)
|
||||
m_Timer.Stop();
|
||||
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), new TimerCallback(OnTick));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Timer != null)
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnTick()
|
||||
{
|
||||
if(DateTime.Now >= m_SeasonEnds)
|
||||
{
|
||||
EndSeason();
|
||||
}
|
||||
|
||||
if (m_NextBonusIndex < DateTime.UtcNow)
|
||||
{
|
||||
m_BonusIndex = Utility.Random(WorldLocationInfo.Locations[0].Length);
|
||||
m_NextBonusIndex = DateTime.UtcNow + TimeSpan.FromHours(6);
|
||||
}
|
||||
|
||||
if (m_NextHint < DateTime.UtcNow)
|
||||
{
|
||||
CheckHint(Map.Trammel);
|
||||
CheckHint(Map.Felucca);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckHint(Map map)
|
||||
{
|
||||
IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(735, 2135, 24, 24));
|
||||
|
||||
foreach (Mobile m in eable)
|
||||
{
|
||||
if (m is BaseVendor)
|
||||
{
|
||||
IPooledEnumerable players = map.GetMobilesInRange(m.Location, 3);
|
||||
|
||||
foreach (Mobile player in players)
|
||||
{
|
||||
if (player is PlayerMobile && ((PlayerMobile)player).NpcGuild == NpcGuild.RangersGuild && !player.Hidden)
|
||||
{
|
||||
GiveHint(player, m);
|
||||
eable.Free();
|
||||
players.Free();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
players.Free();
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
}
|
||||
|
||||
private void GiveHint(Mobile player, Mobile vendor)
|
||||
{
|
||||
vendor.SayTo(player, "A good place to hunt these days is {0}.", WorldLocationInfo.Locations[0][m_BonusIndex].RegionName);
|
||||
|
||||
m_NextHint = DateTime.UtcNow + TimeSpan.FromMinutes(Utility.RandomMinMax(30, 60));
|
||||
}
|
||||
|
||||
public bool IsPrimeHunt(Mobile from, Point3D p)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if (pm == null || pm.NpcGuild != NpcGuild.RangersGuild)
|
||||
return false;
|
||||
|
||||
WorldLocationInfo info = WorldLocationInfo.Locations[0][m_BonusIndex];
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
foreach (Rectangle2D rec in info.Bounds)
|
||||
{
|
||||
if (rec.Contains(p))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void TrySubmitKill(HuntMaster master, Mobile from, HuntingPermit permit)
|
||||
{
|
||||
if(permit.KillEntry == null || permit.KillEntry.KillIndex < 0 || permit.KillEntry.KillIndex > HuntingTrophyInfo.Infos.Count)
|
||||
master.SayTo(from, 1155706); // That is not a valid kill.
|
||||
else
|
||||
{
|
||||
HuntingTrophyInfo info = HuntingTrophyInfo.Infos[permit.KillEntry.KillIndex];
|
||||
|
||||
if(info != null)
|
||||
{
|
||||
if (!m_Leaders.ContainsKey(info.HuntType))
|
||||
m_Leaders[info.HuntType] = new List<HuntingKillEntry>();
|
||||
|
||||
List<HuntingKillEntry> leaders = m_Leaders[info.HuntType];
|
||||
|
||||
if(leaders.Count == 0 || permit.KillEntry.Measurement >= leaders[0].Measurement)
|
||||
{
|
||||
if (leaders.Count > 0 && permit.KillEntry.Measurement > leaders[0].Measurement)
|
||||
leaders.Clear();
|
||||
|
||||
leaders.Add(new HuntingKillEntry(permit.Owner, permit.KillEntry.Measurement, permit.KillEntry.DateKilled, permit.KillEntry.KillIndex, permit.KillEntry.Location));
|
||||
|
||||
from.SendGump(new BasicInfoGump(1155722));
|
||||
|
||||
HuntingDisplayTrophy.InvalidateDisplayTrophies();
|
||||
master.PlaySound(0x3D);
|
||||
}
|
||||
else
|
||||
master.SayTo(from, 1155721); // Begging thy pardon, but your permit has not broken the current record for this species!
|
||||
|
||||
permit.HasSubmitted = true;
|
||||
|
||||
CheckKill(info.HuntType, permit.KillEntry);
|
||||
|
||||
if (from is PlayerMobile)
|
||||
{
|
||||
BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(HuntmastersChallengeQuest));
|
||||
|
||||
if (quest != null && quest is HuntmastersChallengeQuest)
|
||||
{
|
||||
((HuntmastersChallengeQuest)quest).CompleteChallenge();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckKill(HuntType type, HuntingKillEntry entry)
|
||||
{
|
||||
if (!m_Top10.ContainsKey(type))
|
||||
m_Top10[type] = new List<HuntingKillEntry>();
|
||||
|
||||
if (m_Top10[type].Count < 10)
|
||||
m_Top10[type].Add(entry);
|
||||
else
|
||||
{
|
||||
List<HuntingKillEntry> copy = new List<HuntingKillEntry>(m_Top10[type]);
|
||||
copy.Sort();
|
||||
|
||||
for(int i = 0; i < copy.Count; i++)
|
||||
{
|
||||
if (entry.Measurement > copy[i].Measurement)
|
||||
{
|
||||
m_Top10[type].Remove(copy[i]);
|
||||
m_Top10[type].Add(entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void EndSeason()
|
||||
{
|
||||
foreach (KeyValuePair<HuntType, List<HuntingKillEntry>> kvp in m_Leaders)
|
||||
{
|
||||
foreach (HuntingKillEntry killEntry in kvp.Value)
|
||||
{
|
||||
Mobile owner = killEntry.Owner;
|
||||
|
||||
if (owner != null)
|
||||
{
|
||||
if (!m_UnclaimedWinners.ContainsKey(owner))
|
||||
m_UnclaimedWinners[owner] = 1;
|
||||
else
|
||||
m_UnclaimedWinners[owner]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_Leaders.Clear();
|
||||
|
||||
var now = DateTime.Now;
|
||||
var ends = DateTime.Now + TimeSpan.FromDays(30);
|
||||
|
||||
m_SeasonEnds = new DateTime(ends.Year, ends.Month, 1, 0, 0, 0);
|
||||
m_SeasonBegins = new DateTime(now.Year, now.Month, 1, 0, 0, 0);
|
||||
|
||||
HuntingDisplayTrophy.InvalidateDisplayTrophies();
|
||||
}
|
||||
|
||||
public bool CheckUnclaimedEntry(Mobile from, Mobile vendor)
|
||||
{
|
||||
List<Mobile> copy = new List<Mobile>(m_UnclaimedWinners.Keys);
|
||||
|
||||
foreach(Mobile m in copy)
|
||||
{
|
||||
if(m == from && m is PlayerMobile)
|
||||
{
|
||||
m.SendGump(new HuntmasterRewardGump(vendor, (PlayerMobile)m));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public HuntingSystem(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private Dictionary<HuntType, List<HuntingKillEntry>> m_Leaders;
|
||||
public Dictionary<HuntType, List<HuntingKillEntry>> Leaders { get { return m_Leaders; } }
|
||||
|
||||
private Dictionary<Mobile, int> m_UnclaimedWinners = new Dictionary<Mobile, int>();
|
||||
public Dictionary<Mobile, int> UnclaimedWinners { get { return m_UnclaimedWinners; } }
|
||||
|
||||
private Dictionary<HuntType, List<HuntingKillEntry>> m_Top10;
|
||||
public Dictionary<HuntType, List<HuntingKillEntry>> Top10 { get { return m_Top10; } }
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
|
||||
writer.Write(m_Active);
|
||||
writer.Write(m_SeasonBegins);
|
||||
writer.Write(m_SeasonEnds);
|
||||
|
||||
writer.Write(m_UnclaimedWinners.Count);
|
||||
foreach (KeyValuePair<Mobile, int> kvp in m_UnclaimedWinners)
|
||||
{
|
||||
writer.Write(kvp.Key);
|
||||
writer.Write(kvp.Value);
|
||||
}
|
||||
|
||||
writer.Write(m_Top10.Count);
|
||||
foreach (KeyValuePair<HuntType, List<HuntingKillEntry>> kvp in m_Top10)
|
||||
{
|
||||
writer.Write((int)kvp.Key);
|
||||
writer.Write(kvp.Value.Count);
|
||||
|
||||
foreach (HuntingKillEntry entry in kvp.Value)
|
||||
entry.Serialize(writer);
|
||||
}
|
||||
|
||||
writer.Write(m_Leaders.Count);
|
||||
foreach(KeyValuePair<HuntType, List<HuntingKillEntry>> kvp in m_Leaders)
|
||||
{
|
||||
writer.Write((int)kvp.Key);
|
||||
writer.Write(kvp.Value.Count);
|
||||
|
||||
foreach(HuntingKillEntry entry in kvp.Value)
|
||||
entry.Serialize(writer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
m_Active = reader.ReadBool();
|
||||
m_SeasonBegins = reader.ReadDateTime();
|
||||
m_SeasonEnds = reader.ReadDateTime();
|
||||
|
||||
m_Top10 = new Dictionary<HuntType, List<HuntingKillEntry>>();
|
||||
m_Leaders = new Dictionary<HuntType, List<HuntingKillEntry>>();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
Mobile m = reader.ReadMobile();
|
||||
int c = 1;
|
||||
|
||||
if (v == 0)
|
||||
{
|
||||
new HuntingKillEntry(reader);
|
||||
}
|
||||
else
|
||||
{
|
||||
c = reader.ReadInt();
|
||||
}
|
||||
|
||||
if(m != null)
|
||||
m_UnclaimedWinners[m] = c;
|
||||
}
|
||||
|
||||
count = reader.ReadInt();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
HuntType type = (HuntType)reader.ReadInt();
|
||||
int c = reader.ReadInt();
|
||||
|
||||
if (!m_Top10.ContainsKey(type))
|
||||
m_Top10[type] = new List<HuntingKillEntry>();
|
||||
|
||||
for (int j = 0; j < c; j++)
|
||||
{
|
||||
m_Top10[type].Add(new HuntingKillEntry(reader));
|
||||
}
|
||||
}
|
||||
|
||||
count = reader.ReadInt();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
HuntType type = (HuntType)reader.ReadInt();
|
||||
int c = reader.ReadInt();
|
||||
|
||||
if (!m_Leaders.ContainsKey(type))
|
||||
m_Leaders[type] = new List<HuntingKillEntry>();
|
||||
|
||||
for(int j = 0; j < c; j++)
|
||||
{
|
||||
m_Leaders[type].Add(new HuntingKillEntry(reader));
|
||||
}
|
||||
}
|
||||
|
||||
m_Instance = this;
|
||||
m_NextHint = DateTime.UtcNow;
|
||||
m_NextBonusIndex = DateTime.UtcNow;
|
||||
|
||||
CheckTimer();
|
||||
}
|
||||
|
||||
private void Setup()
|
||||
{
|
||||
Static s;
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
s = new Static(2931);
|
||||
s.MoveToWorld(new Point3D(748 + i, 2136, 0), Map.Trammel);
|
||||
|
||||
s = new Static(2928);
|
||||
s.MoveToWorld(new Point3D(748 + i, 2137, 0), Map.Trammel);
|
||||
|
||||
s = new Static(2931);
|
||||
s.MoveToWorld(new Point3D(748 + i, 2136, 0), Map.Felucca);
|
||||
|
||||
s = new Static(2928);
|
||||
s.MoveToWorld(new Point3D(748 + i, 2137, 0), Map.Felucca);
|
||||
}
|
||||
|
||||
s = new Static(2923);
|
||||
s.MoveToWorld(new Point3D(736, 2150, 0), Map.Trammel);
|
||||
|
||||
s = new Static(2925);
|
||||
s.MoveToWorld(new Point3D(736, 2149, 0), Map.Trammel);
|
||||
|
||||
s = new Static(2924);
|
||||
s.MoveToWorld(new Point3D(736, 2148, 0), Map.Trammel);
|
||||
|
||||
s = new Static(2923);
|
||||
s.MoveToWorld(new Point3D(736, 2146, 0), Map.Trammel);
|
||||
|
||||
s = new Static(2925);
|
||||
s.MoveToWorld(new Point3D(736, 2145, 0), Map.Trammel);
|
||||
|
||||
s = new Static(2924);
|
||||
s.MoveToWorld(new Point3D(736, 2144, 0), Map.Trammel);
|
||||
|
||||
s = new Static(2923);
|
||||
s.MoveToWorld(new Point3D(736, 2150, 0), Map.Felucca);
|
||||
|
||||
s = new Static(2925);
|
||||
s.MoveToWorld(new Point3D(736, 2149, 0), Map.Felucca);
|
||||
|
||||
s = new Static(2924);
|
||||
s.MoveToWorld(new Point3D(736, 2148, 0), Map.Felucca);
|
||||
|
||||
s = new Static(2923);
|
||||
s.MoveToWorld(new Point3D(736, 2146, 0), Map.Felucca);
|
||||
|
||||
s = new Static(2925);
|
||||
s.MoveToWorld(new Point3D(736, 2145, 0), Map.Felucca);
|
||||
|
||||
s = new Static(2924);
|
||||
s.MoveToWorld(new Point3D(736, 2144, 0), Map.Felucca);
|
||||
|
||||
HuntingDisplayTrophy trophy = new HuntingDisplayTrophy(HuntType.GrizzlyBear);
|
||||
trophy.MoveToWorld(new Point3D(748, 2137, 6), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.GrizzlyBear);
|
||||
trophy.MoveToWorld(new Point3D(748, 2137, 6), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.GrayWolf);
|
||||
trophy.MoveToWorld(new Point3D(751, 2137, 6), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.GrayWolf);
|
||||
trophy.MoveToWorld(new Point3D(751, 2137, 6), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Cougar);
|
||||
trophy.MoveToWorld(new Point3D(753, 2137, 6), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Cougar);
|
||||
trophy.MoveToWorld(new Point3D(753, 2137, 6), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Turkey);
|
||||
trophy.MoveToWorld(new Point3D(756, 2137, 6), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Turkey);
|
||||
trophy.MoveToWorld(new Point3D(756, 2137, 6), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Bull);
|
||||
trophy.MoveToWorld(new Point3D(748, 2136, 2), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Bull);
|
||||
trophy.MoveToWorld(new Point3D(748, 2136, 2), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Boar);
|
||||
trophy.MoveToWorld(new Point3D(750, 2136, 2), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Boar);
|
||||
trophy.MoveToWorld(new Point3D(750, 2136, 2), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Walrus);
|
||||
trophy.MoveToWorld(new Point3D(752, 2136, 2), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Walrus);
|
||||
trophy.MoveToWorld(new Point3D(752, 2136, 2), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Alligator);
|
||||
trophy.MoveToWorld(new Point3D(754, 2136, 2), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Alligator);
|
||||
trophy.MoveToWorld(new Point3D(754, 2136, 2), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Eagle);
|
||||
trophy.MoveToWorld(new Point3D(756, 2136, 3), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Eagle);
|
||||
trophy.MoveToWorld(new Point3D(756, 2136, 3), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Saurosaurus);
|
||||
trophy.MoveToWorld(new Point3D(746, 2136, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Saurosaurus);
|
||||
trophy.MoveToWorld(new Point3D(746, 2136, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Anchisaur);
|
||||
trophy.MoveToWorld(new Point3D(744, 2136, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Anchisaur);
|
||||
trophy.MoveToWorld(new Point3D(744, 2136, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.BlackTiger);
|
||||
trophy.MoveToWorld(new Point3D(744, 2138, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.BlackTiger);
|
||||
trophy.MoveToWorld(new Point3D(744, 2138, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.WhiteTiger);
|
||||
trophy.MoveToWorld(new Point3D(744, 2140, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.WhiteTiger);
|
||||
trophy.MoveToWorld(new Point3D(744, 2140, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Triceratops);
|
||||
trophy.MoveToWorld(new Point3D(744, 2142, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Triceratops);
|
||||
trophy.MoveToWorld(new Point3D(744, 2142, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Allosaurus);
|
||||
trophy.MoveToWorld(new Point3D(743, 2144, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Allosaurus);
|
||||
trophy.MoveToWorld(new Point3D(743, 2144, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.MyrmidexDrone);
|
||||
trophy.MoveToWorld(new Point3D(741, 2144, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.MyrmidexDrone);
|
||||
trophy.MoveToWorld(new Point3D(741, 2144, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Dimetrosaur);
|
||||
trophy.MoveToWorld(new Point3D(758, 2136, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Dimetrosaur);
|
||||
trophy.MoveToWorld(new Point3D(758, 2136, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Tiger);
|
||||
trophy.MoveToWorld(new Point3D(738, 2144, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Tiger);
|
||||
trophy.MoveToWorld(new Point3D(738, 2144, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Najasaurus);
|
||||
trophy.MoveToWorld(new Point3D(736, 2145, 6), Map.Trammel);
|
||||
|
||||
s = new Static(0x9C03);
|
||||
s.MoveToWorld(new Point3D(736, 2144, 6), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Najasaurus);
|
||||
trophy.MoveToWorld(new Point3D(736, 2145, 6), Map.Felucca);
|
||||
|
||||
s = new Static(0x9C03);
|
||||
s.MoveToWorld(new Point3D(736, 2144, 6), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Lion);
|
||||
trophy.MoveToWorld(new Point3D(736, 2147, 0), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.Lion);
|
||||
trophy.MoveToWorld(new Point3D(736, 2147, 0), Map.Felucca);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.MyrmidexLarvae);
|
||||
trophy.MoveToWorld(new Point3D(736, 2149, 6), Map.Trammel);
|
||||
|
||||
s = new Static(0x9C01);
|
||||
s.MoveToWorld(new Point3D(736, 2149, 6), Map.Trammel);
|
||||
|
||||
trophy = new HuntingDisplayTrophy(HuntType.MyrmidexLarvae);
|
||||
trophy.MoveToWorld(new Point3D(736, 2149, 6), Map.Felucca);
|
||||
|
||||
s = new Static(0x9C01);
|
||||
s.MoveToWorld(new Point3D(736, 2149, 6), Map.Felucca);
|
||||
|
||||
XmlSpawner spawner = new XmlSpawner("HuntMaster");
|
||||
spawner.MoveToWorld(new Point3D(747, 2148, 0), Map.Felucca);
|
||||
spawner.DoRespawn = true;
|
||||
|
||||
spawner = new XmlSpawner("HuntMaster");
|
||||
spawner.MoveToWorld(new Point3D(747, 2148, 0), Map.Trammel);
|
||||
spawner.DoRespawn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
166
Scripts/Services/HuntmasterChallenge/HuntingTrophyInfo.cs
Normal file
166
Scripts/Services/HuntmasterChallenge/HuntingTrophyInfo.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Engines.HuntsmasterChallenge
|
||||
{
|
||||
public enum HuntType
|
||||
{
|
||||
GrizzlyBear,
|
||||
GrayWolf,
|
||||
Cougar,
|
||||
Turkey,
|
||||
Bull,
|
||||
Boar,
|
||||
Walrus,
|
||||
Alligator,
|
||||
Eagle,
|
||||
MyrmidexLarvae,
|
||||
Najasaurus,
|
||||
Anchisaur,
|
||||
Allosaurus,
|
||||
Dimetrosaur,
|
||||
Saurosaurus,
|
||||
Tiger,
|
||||
MyrmidexDrone,
|
||||
Triceratops,
|
||||
Lion,
|
||||
WhiteTiger,
|
||||
BlackTiger,
|
||||
//Publish 102 added:
|
||||
Raptor,
|
||||
SeaSerpent,
|
||||
Scorpion
|
||||
}
|
||||
|
||||
public enum MeasuredBy
|
||||
{
|
||||
Weight,
|
||||
Length,
|
||||
Wingspan
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class HuntingTrophyInfo
|
||||
{
|
||||
private static List<HuntingTrophyInfo> m_Infos = new List<HuntingTrophyInfo>();
|
||||
public static List<HuntingTrophyInfo> Infos { get { return m_Infos; } }
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.GrizzlyBear, typeof(GrizzlyBear), 0x9A26, 1015242, 1123486, 400, 790, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.GrayWolf, typeof(GreyWolf), 0x9A28, 1029681, 1123488, 50, 99, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Cougar, typeof(Cougar), 0x9A2A, 1029603, 1123490, 100, 220, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Turkey, typeof(Turkey), 0x9A2C, 1155714, 1123492, 10, 24, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Bull, typeof(Bull), 0x9A2E, 1072495, 1123494, 1100, 2200, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Boar, typeof(Boar), 0x9A30, 1155715, 1123496, 100, 400, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Walrus, typeof(Walrus), 0x9A32, 1155716, 1123498, 1200, 3700, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Alligator, typeof(Alligator), 0x9A34, 1155717, 1123500, 15, 30, MeasuredBy.Length, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Eagle, typeof(Eagle), 0x9A36, 1072461, 1123502, 10, 20, MeasuredBy.Wingspan, false));
|
||||
|
||||
// Pub 91 Additions
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.MyrmidexLarvae, typeof(MyrmidexLarvae), 0x9C00, 0x9C04, 1156276, 1123960, 20, 40, MeasuredBy.Weight, true));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Najasaurus, typeof(Najasaurus), 0x9C02, 0x9C06, 1156283, 1123962, 200, 400, MeasuredBy.Weight, true));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Anchisaur, typeof(Anchisaur), 0x9C08, 1156284, 1123968, 200, 400, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Allosaurus, typeof(Allosaurus), 0x9C0A, 1156280, 1123970, 5000, 12000, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Dimetrosaur, typeof(Dimetrosaur), 0x9C0C, 1156279, 1123972, 200, 400, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Saurosaurus, typeof(Saurosaurus), 0x9C0E, 1156289, 1123974, 1500, 2000, MeasuredBy.Weight, false));
|
||||
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.MyrmidexDrone, typeof(MyrmidexDrone), 0x9DA6, 1156134, 1124382, 100, 200, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Tiger, typeof(WildTiger), 0x9DA4, 1156286, 1124380, 350, 700, MeasuredBy.Weight, false));
|
||||
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Triceratops, typeof(Triceratops), 0x9F2C, 0x9F2B, 1124731, 1124771, 10000, 15000, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Lion, typeof(Lion), 0x9F2E, 0x9F2D, 1124736, 1124773, 350, 700, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.WhiteTiger, typeof(WildWhiteTiger), 0x9F30, 0x9F2F, 1156286, 1124775, 350, 700, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.BlackTiger, typeof(WildBlackTiger), 0x9F32, 0x9F31, 1156286, 1124777, 350, 700, MeasuredBy.Weight, false));
|
||||
|
||||
//Publish 102
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Raptor, typeof(Raptor), 0xA20E, 0xA20D, 1095923, 1125508, 400, 800, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.SeaSerpent, typeof(SeaSerpent), 0xA20C, 0xA20C, 1018242, 1125508, 200, 600, MeasuredBy.Weight, false));
|
||||
m_Infos.Add(new HuntingTrophyInfo(HuntType.Scorpion, typeof(Scorpion), 0xA210, 0xA20F, 1029657, 1125508, 250, 500, MeasuredBy.Weight, false));
|
||||
}
|
||||
|
||||
private HuntType m_HuntType;
|
||||
private Type m_CreatureType;
|
||||
private MeasuredBy m_MeasuredBy;
|
||||
private int m_SouthID, m_EastID, m_MinMeasurement, m_MaxMeasurement;
|
||||
private TextDefinition m_Species, m_TrophyName;
|
||||
private bool m_Complex;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HuntType HuntType { get { return m_HuntType; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Type CreatureType { get { return m_CreatureType; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public MeasuredBy MeasuredBy { get { return m_MeasuredBy; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int SouthID { get { return m_SouthID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int EastID { get { return m_EastID; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TextDefinition Species { get { return m_Species; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TextDefinition TrophyName { get { return m_TrophyName; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MinMeasurement { get { return m_MinMeasurement; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int MaxMeasurement { get { return m_MaxMeasurement; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Complex { get { return m_Complex; } }
|
||||
|
||||
public HuntingTrophyInfo(HuntType type, Type creatureType, int southID, TextDefinition species, TextDefinition trophyName, int minMeasurement, int maxMeasurement, MeasuredBy measuredBy, bool complex)
|
||||
: this(type, creatureType, southID, southID + 1, species, trophyName, minMeasurement, maxMeasurement, measuredBy, complex)
|
||||
{
|
||||
}
|
||||
|
||||
public HuntingTrophyInfo(HuntType type, Type creatureType, int southID, int eastID, TextDefinition species, TextDefinition trophyName, int minMeasurement, int maxMeasurement, MeasuredBy measuredBy, bool complex)
|
||||
{
|
||||
m_HuntType = type;
|
||||
m_CreatureType = creatureType;
|
||||
m_MeasuredBy = measuredBy;
|
||||
m_SouthID = southID;
|
||||
m_EastID = eastID;
|
||||
m_Species = species;
|
||||
m_TrophyName = trophyName;
|
||||
m_MinMeasurement = minMeasurement;
|
||||
m_MaxMeasurement = maxMeasurement;
|
||||
m_Complex = complex;
|
||||
}
|
||||
|
||||
public static HuntingTrophyInfo GetInfo(HuntType type)
|
||||
{
|
||||
foreach (HuntingTrophyInfo info in m_Infos)
|
||||
{
|
||||
if (info.HuntType == type)
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int CheckInfo(int number)
|
||||
{
|
||||
for (int i = 0; i < HuntingTrophyInfo.Infos.Count; i++)
|
||||
{
|
||||
var info = HuntingTrophyInfo.Infos[i];
|
||||
|
||||
if (info.Species.Number == number)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
76
Scripts/Services/HuntmasterChallenge/KillEntry.cs
Normal file
76
Scripts/Services/HuntmasterChallenge/KillEntry.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.HuntsmasterChallenge
|
||||
{
|
||||
[PropertyObject]
|
||||
public class HuntingKillEntry : IComparable
|
||||
{
|
||||
private Mobile m_Owner;
|
||||
private int m_Measurement;
|
||||
private int m_KillIndex;
|
||||
private DateTime m_DateKilled;
|
||||
private string m_Location;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Owner { get { return m_Owner; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Measurement { get { return m_Measurement; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int KillIndex { get { return m_KillIndex; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime DateKilled { get { return m_DateKilled; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string Location { get { return m_Location; } }
|
||||
|
||||
public HuntingKillEntry(Mobile owner, int measurement, DateTime DateKilled, int killindex, string location)
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Measurement = measurement;
|
||||
m_DateKilled = DateKilled;
|
||||
m_KillIndex = killindex;
|
||||
m_Location = location;
|
||||
}
|
||||
|
||||
public int CompareTo(object o)
|
||||
{
|
||||
if(((HuntingKillEntry)o).KillIndex == m_KillIndex || m_KillIndex < 0 || m_KillIndex >= HuntingTrophyInfo.Infos.Count)
|
||||
return ((HuntingKillEntry)o).Measurement - m_Measurement;
|
||||
|
||||
HuntingTrophyInfo info1 = HuntingTrophyInfo.Infos[((HuntingKillEntry)o).KillIndex];
|
||||
HuntingTrophyInfo info2 = HuntingTrophyInfo.Infos[m_KillIndex];
|
||||
|
||||
double perc1 = (double)((double)((HuntingKillEntry)o).Measurement / info1.MaxMeasurement);
|
||||
double perc2 = (double)((double)m_Measurement / info2.MaxMeasurement);
|
||||
|
||||
return (int)((perc1 * 100) - (perc2 * 100));
|
||||
}
|
||||
|
||||
public HuntingKillEntry(GenericReader reader)
|
||||
{
|
||||
int v = reader.ReadInt();
|
||||
|
||||
m_Owner = reader.ReadMobile();
|
||||
m_Measurement = reader.ReadInt();
|
||||
m_DateKilled = reader.ReadDateTime();
|
||||
m_KillIndex = reader.ReadInt();
|
||||
m_Location = reader.ReadString();
|
||||
}
|
||||
|
||||
public void Serialize(GenericWriter writer)
|
||||
{
|
||||
writer.Write((int)0);
|
||||
|
||||
writer.Write(m_Owner);
|
||||
writer.Write(m_Measurement);
|
||||
writer.Write(m_DateKilled);
|
||||
writer.Write(m_KillIndex);
|
||||
writer.Write(m_Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
175
Scripts/Services/HuntmasterChallenge/ResourceSatchels.cs
Normal file
175
Scripts/Services/HuntmasterChallenge/ResourceSatchels.cs
Normal file
@@ -0,0 +1,175 @@
|
||||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseResourceSatchel : Container
|
||||
{
|
||||
public const int DefaultWeightReduction = 50;
|
||||
|
||||
private int _WeightReduction;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int WeightReduction { get { return _WeightReduction; } set { _WeightReduction = value; InvalidateProperties(); } }
|
||||
|
||||
public abstract Type[] HoldTypes { get; }
|
||||
|
||||
public BaseResourceSatchel(int id)
|
||||
: base(id)
|
||||
{
|
||||
_WeightReduction = DefaultWeightReduction;
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_WeightReduction != 0)
|
||||
list.Add(1072210, _WeightReduction.ToString()); // Weight reduction: ~1_PERCENTAGE~%
|
||||
}
|
||||
|
||||
public override int GetTotal(TotalType type)
|
||||
{
|
||||
int total = base.GetTotal(type);
|
||||
|
||||
if (type == TotalType.Weight)
|
||||
total -= total * (int)((double)_WeightReduction / 100.0);
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight)
|
||||
{
|
||||
if (!CheckType(item))
|
||||
{
|
||||
if (message)
|
||||
m.SendLocalizedMessage(1074836); // The container can not hold that type of object.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckHold(m, item, message, checkItems, plusItems, plusWeight);
|
||||
}
|
||||
|
||||
public bool CheckType(Item item)
|
||||
{
|
||||
Type type = item.GetType();
|
||||
|
||||
foreach (var t in HoldTypes)
|
||||
{
|
||||
if (type == t || type.IsSubclassOf(t))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void InvalidateWeight()
|
||||
{
|
||||
if (RootParent is Mobile)
|
||||
{
|
||||
Mobile m = (Mobile)RootParent;
|
||||
|
||||
m.UpdateTotals();
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddItem(Item dropped)
|
||||
{
|
||||
base.AddItem(dropped);
|
||||
|
||||
InvalidateWeight();
|
||||
}
|
||||
|
||||
public override void RemoveItem(Item dropped)
|
||||
{
|
||||
base.RemoveItem(dropped);
|
||||
|
||||
InvalidateWeight();
|
||||
}
|
||||
|
||||
public BaseResourceSatchel(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(_WeightReduction);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_WeightReduction = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
[Flipable(0xA272, 0xA273)]
|
||||
public class MinersSatchel : BaseResourceSatchel
|
||||
{
|
||||
public override int LabelNumber { get { return 1158773; } } // Miner's Satchel
|
||||
|
||||
public override Type[] HoldTypes { get { return new Type[] { typeof(BaseOre), typeof(BaseIngot), typeof(Granite), typeof(Saltpeter) }; } }
|
||||
|
||||
[Constructable]
|
||||
public MinersSatchel()
|
||||
: base(0xA272)
|
||||
{
|
||||
}
|
||||
|
||||
public MinersSatchel(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
[Flipable(0xA274, 0xA275)]
|
||||
public class LumbjacksSatchel : BaseResourceSatchel
|
||||
{
|
||||
public override int LabelNumber { get { return 1158772; } } // Lumberjack's Satchel
|
||||
|
||||
public override Type[] HoldTypes { get { return new Type[] { typeof(BaseLog), typeof(Board) }; } }
|
||||
|
||||
[Constructable]
|
||||
public LumbjacksSatchel()
|
||||
: base(0xA274)
|
||||
{
|
||||
}
|
||||
|
||||
public LumbjacksSatchel(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
310
Scripts/Services/HuntmasterChallenge/RewardItems.cs
Normal file
310
Scripts/Services/HuntmasterChallenge/RewardItems.cs
Normal file
@@ -0,0 +1,310 @@
|
||||
using Server;
|
||||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Engines.HuntsmasterChallenge;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HarvestersBlade : ElvenSpellblade
|
||||
{
|
||||
public override int LabelNumber { get { return 1114096; } } // Harvester's Blade
|
||||
|
||||
[Constructable]
|
||||
public HarvestersBlade()
|
||||
{
|
||||
Hue = 1191;
|
||||
Attributes.SpellChanneling = 1;
|
||||
}
|
||||
|
||||
public HarvestersBlade(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
if(v == 0)
|
||||
Hue = 1191;
|
||||
}
|
||||
}
|
||||
|
||||
public class RangersGuildSash : BodySash
|
||||
{
|
||||
public override int LabelNumber { get { return 1155744; } } // Member of the Skara Brae Ranger's Guild
|
||||
|
||||
[Constructable]
|
||||
public RangersGuildSash()
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public RangersGuildSash(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class GargishRangersGuildSash : GargishSash
|
||||
{
|
||||
public override int LabelNumber { get { return 1155744; } } // Member of the Skara Brae Ranger's Guild
|
||||
|
||||
[Constructable]
|
||||
public GargishRangersGuildSash()
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public GargishRangersGuildSash(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class HuntmastersRewardTitleDeed : BaseRewardTitleDeed
|
||||
{
|
||||
public override TextDefinition Title { get { return new TextDefinition(1155727); } } // Huntmaster's Champion
|
||||
|
||||
[Constructable]
|
||||
public HuntmastersRewardTitleDeed()
|
||||
{
|
||||
}
|
||||
|
||||
public HuntmastersRewardTitleDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)0);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
[Flipable(18080, 18081)]
|
||||
public class HornOfPlenty : Item, IUsesRemaining
|
||||
{
|
||||
public override int LabelNumber { get { return 1153503; } } // Horn of Plenty
|
||||
|
||||
private int m_UsesRemaining;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int UsesRemaining
|
||||
{
|
||||
get { return m_UsesRemaining; }
|
||||
set { m_UsesRemaining = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public bool ShowUsesRemaining { get { return true; } set { } }
|
||||
|
||||
private DateTime _NextRecharge;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public DateTime NextRecharge
|
||||
{
|
||||
get { return _NextRecharge; }
|
||||
set { _NextRecharge = value; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public HornOfPlenty() : base(18080)
|
||||
{
|
||||
UsesRemaining = 10;
|
||||
}
|
||||
|
||||
//TODO: add pub 84, 88 and 95 shit
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (m_UsesRemaining > 0)
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
switch (Utility.Random(10))
|
||||
{
|
||||
case 0: item = new SweetPotatoPie(); break;
|
||||
case 1: item = new MashedSweetPotatoes(); break;
|
||||
case 2: item = new BasketOfRolls(); break;
|
||||
case 3: item = new TurkeyPlatter(); break;
|
||||
case 4:
|
||||
BaseCreature bc = new Turkey(true);
|
||||
if (0.10 > Utility.RandomDouble())
|
||||
bc.Name = "Mister Gobbles";
|
||||
bc.MoveToWorld(from.Location, from.Map);
|
||||
from.SendLocalizedMessage(1153512); //That one's not cooked!
|
||||
break;
|
||||
case 5:
|
||||
new InternalTimer(from);
|
||||
from.Frozen = true;
|
||||
break;
|
||||
case 6: item = new PottedCoffeePlant(); break;
|
||||
case 7: item = new RoastingPigOnASpitDeed(); break;
|
||||
case 8: item = new FormalDiningTableDeed(); break;
|
||||
case 9: item = new BuffetTableDeed(); break;
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
if (from.Backpack == null || !from.Backpack.TryDropItem(from, item, false))
|
||||
item.MoveToWorld(from.Location, from.Map);
|
||||
|
||||
UsesRemaining--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
private int m_Ticks;
|
||||
|
||||
public InternalTimer(Mobile from)
|
||||
: base(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1))
|
||||
{
|
||||
m_From = from;
|
||||
Start();
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Ticks++;
|
||||
|
||||
if (m_Ticks % 3 == 0)
|
||||
m_From.Say(1153513); // * ZzzzZzzzZzzzZ *
|
||||
|
||||
if (m_Ticks == 10)
|
||||
{
|
||||
this.Stop();
|
||||
m_From.Frozen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddUsesRemainingProperties(ObjectPropertyList list)
|
||||
{
|
||||
if(ShowUsesRemaining)
|
||||
list.Add(1049116, m_UsesRemaining.ToString()); // [ Charges: ~1_CHARGES~ ]
|
||||
}
|
||||
|
||||
private void CheckRecharge()
|
||||
{
|
||||
if (DateTime.UtcNow.Month == 11 && UsesRemaining < 10 && _NextRecharge < DateTime.UtcNow)
|
||||
{
|
||||
UsesRemaining++;
|
||||
_NextRecharge = DateTime.UtcNow + TimeSpan.FromDays(1);
|
||||
}
|
||||
}
|
||||
|
||||
public HornOfPlenty(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write((int)1);
|
||||
|
||||
writer.Write(_NextRecharge);
|
||||
writer.Write(m_UsesRemaining);
|
||||
|
||||
CheckRecharge();
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int v = reader.ReadInt();
|
||||
|
||||
switch (v)
|
||||
{
|
||||
case 1:
|
||||
_NextRecharge = reader.ReadDateTime();
|
||||
goto case 0;
|
||||
case 0:
|
||||
m_UsesRemaining = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HarvestersAxe : TwoHandedAxe
|
||||
{
|
||||
public override int LabelNumber { get { return 1158774; } } // Harvester's Axe
|
||||
|
||||
private int _Charges;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Charges { get { return _Charges; } set { _Charges = value; InvalidateProperties(); } }
|
||||
|
||||
[Constructable]
|
||||
public HarvestersAxe()
|
||||
{
|
||||
Charges = 1000;
|
||||
}
|
||||
|
||||
public override void AddWeightProperty(ObjectPropertyList list)
|
||||
{
|
||||
base.AddWeightProperty(list);
|
||||
list.Add(1158775); // * Magically Chops Logs into Boards *
|
||||
list.Add(1060741, _Charges.ToString()); // charges:
|
||||
}
|
||||
|
||||
public HarvestersAxe(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(0);
|
||||
|
||||
writer.Write(_Charges);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
_Charges = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user