本文整理汇总了C#中DOL.GS.Keeps.GameKeepComponent.LoadFromDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# GameKeepComponent.LoadFromDatabase方法的具体用法?C# GameKeepComponent.LoadFromDatabase怎么用?C# GameKeepComponent.LoadFromDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.Keeps.GameKeepComponent
的用法示例。
在下文中一共展示了GameKeepComponent.LoadFromDatabase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCommand
public void OnCommand(GameClient client, string[] args)
{
if (args.Length == 1)
{
DisplaySyntax(client);
return;
}
AbstractGameKeep myKeep = (AbstractGameKeep)client.Player.TempProperties.getProperty<object>(TEMP_KEEP_LAST, null);
if (myKeep == null) myKeep = GameServer.KeepManager.GetKeepCloseToSpot(client.Player.CurrentRegionID, client.Player, 10000);
switch (args[1])
{
#region FastCreate
case "fastcreate":
{
#region DisplayTemplates
if (args.Length < 5)
{
DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Keep.FastCreate.TypeOfKeep"));
int i = 1;
foreach (string str in Enum.GetNames(typeof(eKeepTypes)))
{
DisplayMessage(client, "#" + i + ": " + str);
i++;
}
return;
}
#endregion DisplayTemplates
int keepType = 0;
int keepID = 0;
string keepName = "New Keep";
try
{
keepType = Convert.ToInt32(args[2]);
keepID = Convert.ToInt32(args[3]);
keepName = String.Join(" ", args, 4, args.Length - 4);
}
catch
{
DisplayMessage(client, "Invalid parameter for Keep Type, Keep ID, or Keep Name");
return;
}
if ((keepID >> 8) != 0 || GameServer.KeepManager.Keeps[keepID] != null)
{
DisplayMessage(client, "KeepID must be unused and less than 256.");
return;
}
string createInfo = client.Player.Name + ";" + string.Format("/keep fastcreate {0} {1} {2}", keepType, keepID, keepName);
GameKeep keep = new GameKeep();
keep.DBKeep = new DBKeep(createInfo);
keep.Name = keepName;
keep.KeepID = keepID;
keep.Level = (byte)ServerProperties.Properties.STARTING_KEEP_LEVEL;
keep.BaseLevel = 50;
keep.Realm = client.Player.Realm;
keep.Region = client.Player.CurrentRegionID;
keep.X = client.Player.X;
keep.Y = client.Player.Y;
keep.Z = client.Player.Z;
keep.Heading = client.Player.Heading;
if ((int)keepType < 8)
{
keep.KeepType = (AbstractGameKeep.eKeepType)keepType;
}
else
{
keep.KeepType = 0;
}
log.Debug("Keep creation: starting");
// TODO: Add keep component to list in keep class
// SQL to grab current keep components from a DB that works. Replace keepID with the one you want to edit here.
// Values below taken from Storm with working old style keeps
// select concat(ID, ', ', skin, ', ', x, ', ', y, ', ', heading, ', ', height, ', ', health) as keepcomponent from keepcomponent where keepid = ### order by id;
GameKeepComponent keepComp = null;
switch ((eKeepTypes)keepType)
{
#region DunCrauchonBledmeerFasteCaerBenowyc
case eKeepTypes.DunCrauchonBledmeerFasteCaerBenowyc:
{
keepComp = new GameKeepComponent();
keepComp.LoadFromDatabase(new DBKeepComponent(0, 0, 254, 250, 0, 0, 3200, keep.KeepID, createInfo), keep);
keep.KeepComponents.Add(keepComp);
keepComp = new GameKeepComponent();
keepComp.LoadFromDatabase(new DBKeepComponent(1, 2, 251, 250, 0, 0, 3200, keep.KeepID, createInfo), keep);
keep.KeepComponents.Add(keepComp);
keepComp = new GameKeepComponent();
keepComp.LoadFromDatabase(new DBKeepComponent(2, 1, 4, 250, 0, 0, 3200, keep.KeepID, createInfo), keep);
//.........这里部分代码省略.........
示例2: Load
//.........这里部分代码省略.........
{
if (dum.Skin >= 0 && dum.Skin <= 20) //these are the min/max ids for old keeps.
isOld = true;
if (dum.Skin > 20) //any skinID greater than this are ids for new keeps.
isNew = true;
}
//Now, consult server properties to decide our plan!
//Quote: ServerProperties.cs
//"use_new_keeps", "Keeps to load. 0 for Old Keeps, 1 for new keeps, 2 for both.", 2
if (ServerProperties.Properties.USE_NEW_KEEPS == 0 && isNew)
continue;
if (ServerProperties.Properties.USE_NEW_KEEPS == 1 && isOld)
continue;
//If we've got this far, we are permitted to load as per normal!
AbstractGameKeep keep;
if ((datakeep.KeepID >> 8) != 0)
{
keep = new GameKeepTower();
}
else
{
keep = new GameKeep();
}
keep.Load(datakeep);
m_keeps.Add(datakeep.KeepID, keep);
}
// This adds owner keeps to towers / portal keeps
foreach (AbstractGameKeep keep in m_keeps.Values)
{
GameKeepTower tower = keep as GameKeepTower;
if (tower != null)
{
int index = tower.KeepID & 0xFF;
GameKeep ownerKeep = getKeepByID(index) as GameKeep;
if (ownerKeep != null)
{
ownerKeep.AddTower(tower);
}
tower.Keep = ownerKeep;
}
}
bool missingKeeps = false;
var keepcomponents = GameServer.Database.SelectAllObjects<DBKeepComponent>();
foreach (DBKeepComponent component in keepcomponents)
{
// if use old keeps don't try to load new components
if (ServerProperties.Properties.USE_NEW_KEEPS == 0 && IsNewKeepComponent(component.Skin))
continue;
// if use new keeps don't try and load old components
if (ServerProperties.Properties.USE_NEW_KEEPS == 1 && !IsNewKeepComponent(component.Skin))
continue;
AbstractGameKeep keep = getKeepByID(component.KeepID);
if (keep == null)
{
missingKeeps = true;
continue;
}
GameKeepComponent gamecomponent = new GameKeepComponent();
gamecomponent.LoadFromDatabase(component, keep);
keep.KeepComponents.Add(gamecomponent);
}
if (missingKeeps && Logger.IsWarnEnabled)
{
Logger.WarnFormat("Some keeps not found while loading components, possibly old/new keeptype; see server properties");
}
if (m_keeps.Count != 0)
{
foreach (AbstractGameKeep keep in m_keeps.Values)
{
if (keep.KeepComponents.Count != 0)
keep.KeepComponents.Sort();
}
}
LoadHookPoints();
Logger.Info("Loaded " + m_keeps.Count + " keeps successfully");
}
if (ServerProperties.Properties.USE_KEEP_BALANCING)
UpdateBaseLevels();
if (ServerProperties.Properties.USE_LIVE_KEEP_BONUSES)
KeepBonusMgr.UpdateCounts();
return true;
}