本文整理汇总了C#中GameNPC.AddToWorld方法的典型用法代码示例。如果您正苦于以下问题:C# GameNPC.AddToWorld方法的具体用法?C# GameNPC.AddToWorld怎么用?C# GameNPC.AddToWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameNPC
的用法示例。
在下文中一共展示了GameNPC.AddToWorld方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LockRelic
public static bool LockRelic()
{
//make sure the relic exists before you lock it!
if (Relic == null)
return false;
LockedEffect = new GameNPC();
LockedEffect.Model = 1583;
LockedEffect.Name = "LOCKED_RELIC";
LockedEffect.X = Relic.X;
LockedEffect.Y = Relic.Y;
LockedEffect.Z = Relic.Z;
LockedEffect.Heading = Relic.Heading;
LockedEffect.CurrentRegionID = Relic.CurrentRegionID;
LockedEffect.Flags = GameNPC.eFlags.CANTTARGET;
LockedEffect.AddToWorld();
return true;
}
示例2: OnScriptsCompiled
public static void OnScriptsCompiled(DOLEvent e, object sender, EventArgs args)
{
// What npctemplate should we use for the zonepoint ?
ushort model;
NpcTemplate zp;
try{
model = (ushort)ServerProperties.Properties.ZONEPOINT_NPCTEMPLATE;
zp = new NpcTemplate(GameServer.Database.SelectObjects<DBNpcTemplate>("`TemplateId` = @TemplateId", new QueryParameter("@TemplateId", model)).FirstOrDefault());
if (model <= 0 || zp == null) throw new ArgumentNullException();
}
catch {
return;
}
// processing all the ZP
IList<ZonePoint> zonePoints = GameServer.Database.SelectAllObjects<ZonePoint>();
foreach (ZonePoint z in zonePoints)
{
if (z.SourceRegion == 0) continue;
// find target region for the current zonepoint
Region r = WorldMgr.GetRegion(z.TargetRegion);
if (r == null)
{
log.Warn("Zonepoint Id (" + z.Id + ") references an inexistent target region " + z.TargetRegion + " - skipping, ZP not created");
continue;
}
GameNPC npc = new GameNPC(zp);
npc.CurrentRegionID = z.SourceRegion;
npc.X = z.SourceX;
npc.Y = z.SourceY;
npc.Z = z.SourceZ;
npc.Name = r.Description;
npc.GuildName = "ZonePoint (Open)";
if (r.IsDisabled) npc.GuildName = "ZonePoint (Closed)";
npc.AddToWorld();
}
}
示例3: OnScriptsCompiled
public static void OnScriptsCompiled(DOLEvent e, object sender, EventArgs args)
{
// What npctemplate should we use for the zonepoint ?
ushort model;
NpcTemplate zp;
try
{
model = (ushort)ServerProperties.Properties.ZONEPOINT_NPCTEMPLATE;
zp = new NpcTemplate(GameServer.Database.SelectObject<DBNpcTemplate>("TemplateId =" + model.ToString()));
if (model <= 0 || zp == null) throw new ArgumentNullException();
}
catch
{
return;
}
// processing all the ZP
IList<ZonePoint> zonePoints = GameServer.Database.SelectAllObjects<ZonePoint>();
foreach (ZonePoint z in zonePoints)
{
if (z.SourceRegion == 0)
continue;
//find region
Region r = WorldMgr.GetRegion(z.TargetRegion);
GameNPC npc = new GameNPC(zp);
npc.CurrentRegionID = z.SourceRegion;
npc.X = z.SourceX;
npc.Y = z.SourceY;
npc.Z = z.SourceZ;
npc.Name = r.Description;
if (r.IsDisabled)
npc.GuildName = "ZonePoint (Closed)";
else npc.GuildName = "ZonePoint (Open)";
npc.AddToWorld();
}
}
示例4: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
/* First thing we do in here is to search for the NPCs inside
* the world who comes from the certain Realm. If we find a the players,
* this means we don't have to create a new one.
*
* NOTE: You can do anything you want in this method, you don't have
* to search for NPC's ... you could create a custom item, place it
* on the ground and if a player picks it up, he will get the quest!
* Just examples, do anything you like and feel comfortable with :)
*/
#region defineNPCS
GameNPC[] npcs = WorldMgr.GetNPCsByName("Hugh Gallen", eRealm.Albion);
/* Whops, if the npcs array length is 0 then no npc exists in
* this users Mob Database, so we simply create one ;-)
* else we take the existing one. And if more than one exist, we take
* the first ...
*/
if (npcs.Length == 0)
{
hughGallen = new GameNPC();
hughGallen.Model = 40;
hughGallen.Name = "Hugh Gallen";
if (log.IsWarnEnabled)
log.Warn("Could not find " + hughGallen.Name + ", creating him ...");
hughGallen.GuildName = "Part of " + questTitle + " Quest";
hughGallen.Realm = eRealm.Albion;
hughGallen.CurrentRegionID = 1;
GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
hughGallen.Inventory = template.CloseTemplate();
hughGallen.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);
hughGallen.Size = 49;
hughGallen.Level = 38;
hughGallen.X = 574640;
hughGallen.Y = 531109;
hughGallen.Z = 2896;
hughGallen.Heading = 2275;
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
hughGallen.SaveIntoDatabase();
hughGallen.AddToWorld();
}
else
hughGallen = npcs[0];
#endregion
#region defineItems
// item db check
beltOfAnimation = GameServer.Database.FindObjectByKey<ItemTemplate>("belt_of_animation");
if (beltOfAnimation == null)
{
beltOfAnimation = new ItemTemplate();
beltOfAnimation.Name = "Belt of Animation";
if (log.IsWarnEnabled)
log.Warn("Could not find "+beltOfAnimation.Name+", creating it ...");
beltOfAnimation.Level = 5;
beltOfAnimation.Weight = 3;
beltOfAnimation.Model = 597;
beltOfAnimation.Object_Type = (int) eObjectType.Magical;
beltOfAnimation.Item_Type = (int) eEquipmentItems.WAIST;
beltOfAnimation.Id_nb = "belt_of_animation";
beltOfAnimation.Price = 0;
beltOfAnimation.IsPickable = true;
beltOfAnimation.IsDropable = false; // can't be sold to merchand
beltOfAnimation.Bonus1 = 6;
beltOfAnimation.Bonus1Type = (int)eProperty.MaxHealth;
beltOfAnimation.Quality = 100;
beltOfAnimation.Condition = 1000;
beltOfAnimation.MaxCondition = 1000;
beltOfAnimation.Durability = 1000;
beltOfAnimation.MaxDurability = 1000;
//You don't have to store the created item in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
//.........这里部分代码省略.........
示例5: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
/* First thing we do in here is to search for the NPCs inside
* the world who comes from the certain Realm. If we find a the players,
* this means we don't have to create a new one.
*
* NOTE: You can do anything you want in this method, you don't have
* to search for NPC's ... you could create a custom item, place it
* on the ground and if a player picks it up, he will get the quest!
* Just examples, do anything you like and feel comfortable with :)
*/
#region defineNPCS
GameNPC[] npcs = WorldMgr.GetNPCsByName("Elvar Ironhand", eRealm.Albion);
/* Whops, if the npcs array length is 0 then no npc exists in
* this users Mob Database, so we simply create one ;-)
* else we take the existing one. And if more than one exist, we take
* the first ...
*/
if (npcs.Length == 0)
{
elvarIronhand = new GameNPC();
elvarIronhand.Model = 10;
elvarIronhand.Name = "Elvar Ironhand";
if (log.IsWarnEnabled)
log.Warn("Could not find " + elvarIronhand.Name + ", creating him ...");
elvarIronhand.GuildName = "Part of " + questTitle + " Quest";
elvarIronhand.Realm = eRealm.Albion;
elvarIronhand.CurrentRegionID = 1;
GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 12);
elvarIronhand.Inventory = template.CloseTemplate();
elvarIronhand.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);
elvarIronhand.Size = 54;
elvarIronhand.Level = 17;
elvarIronhand.X = 561351;
elvarIronhand.Y = 510292;
elvarIronhand.Z = 2400;
elvarIronhand.Heading = 3982;
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
elvarIronhand.SaveIntoDatabase();
elvarIronhand.AddToWorld();
}
else
elvarIronhand = npcs[0];
#endregion
#region defineItems
// item db check
wellPreservedBones = GameServer.Database.FindObjectByKey<ItemTemplate>("well_preserved_bone");
if (wellPreservedBones == null)
{
wellPreservedBones = new ItemTemplate();
wellPreservedBones.Name = "Well-Preserved Bone";
if (log.IsWarnEnabled)
log.Warn("Could not find "+wellPreservedBones.Name+", creating it ...");
wellPreservedBones.Level = 0;
wellPreservedBones.Weight = 1;
wellPreservedBones.Model = 497;
wellPreservedBones.Object_Type = (int) eObjectType.GenericItem;
wellPreservedBones.Id_nb = "well_preserved_bone";
wellPreservedBones.Price = 0;
wellPreservedBones.IsPickable = false;
wellPreservedBones.IsDropable = false;
wellPreservedBones.Quality = 100;
wellPreservedBones.Condition = 1000;
wellPreservedBones.MaxCondition = 1000;
wellPreservedBones.Durability = 1000;
wellPreservedBones.MaxDurability = 1000;
//You don't have to store the created item in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
GameServer.Database.AddObject(wellPreservedBones);
}
// item db check
twoWellPreservedBones = GameServer.Database.FindObjectByKey<ItemTemplate>("two_well_preserved_bones");
if (twoWellPreservedBones == null)
{
//.........这里部分代码省略.........
示例6: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
/* First thing we do in here is to search for the NPCs inside
* the world who comes from the Albion realm. If we find a the players,
* this means we don't have to create a new one.
*
* NOTE: You can do anything you want in this method, you don't have
* to search for NPC's ... you could create a custom item, place it
* on the ground and if a player picks it up, he will get the quest!
* Just examples, do anything you like and feel comfortable with :)
*/
#region defineNPCs
addrir = GetAddrir();
GameNPC[] npcs = WorldMgr.GetNPCsByName("Aethic", eRealm.Hibernia);
if (npcs.Length == 0)
{
aethic = new GameNPC();
aethic.Model = 361;
aethic.Name = "Aethic";
if (log.IsWarnEnabled)
log.Warn("Could not find" + aethic.Name + " , creating ...");
aethic.GuildName = "Part of " + questTitle + " Quest";
aethic.Realm = eRealm.Hibernia;
aethic.CurrentRegionID = 200;
aethic.Size = 49;
aethic.Level = 21;
aethic.X = GameLocation.ConvertLocalXToGlobalX(23761, 200);
aethic.Y = GameLocation.ConvertLocalYToGlobalY(45658, 200);
aethic.Z = 5448;
aethic.Heading = 320;
//aethic.EquipmentTemplateID = "1707754";
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
aethic.SaveIntoDatabase();
aethic.AddToWorld();
}
else
aethic = npcs[0] as GameStableMaster;
npcs = WorldMgr.GetNPCsByName("Freagus", eRealm.Hibernia);
if (npcs.Length == 0)
{
freagus = new GameStableMaster();
freagus.Model = 361;
freagus.Name = "Freagus";
if (log.IsWarnEnabled)
log.Warn("Could not find " + freagus.Name + ", creating ...");
freagus.GuildName = "Stable Master";
freagus.Realm = eRealm.Hibernia;
freagus.CurrentRegionID = 200;
freagus.Size = 48;
freagus.Level = 30;
freagus.X = 341008;
freagus.Y = 469180;
freagus.Z = 5200;
freagus.Heading = 1934;
freagus.EquipmentTemplateID = "3800664";
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
freagus.SaveIntoDatabase();
freagus.AddToWorld();
}
else
freagus = npcs[0];
npcs = WorldMgr.GetNPCsByName("Rumdor", eRealm.Hibernia);
if (npcs.Length == 0)
{
if (log.IsWarnEnabled)
log.Warn("Could not find Rumdor, creating ...");
rumdor = new GameStableMaster();
rumdor.Model = 361;
rumdor.Name = "Rumdor";
rumdor.GuildName = "Stable Master";
rumdor.Realm = eRealm.Hibernia;
rumdor.CurrentRegionID = 200;
rumdor.Size = 53;
rumdor.Level = 33;
rumdor.X = 347175;
rumdor.Y = 491836;
rumdor.Z = 5226;
rumdor.Heading = 1262;
rumdor.EquipmentTemplateID = "3800664";
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
//.........这里部分代码省略.........
示例7: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
#region defineNPCS
GameNPC[] npcs = WorldMgr.GetNPCsByName(questGiverName, eRealm.Hibernia);
if (npcs.Length == 0)
{
if (log.IsWarnEnabled)
log.Warn("Could not find " + questGiverName + ", creating her ...");
questGiver = new GameNPC();
questGiver.Name = questGiverName;
questGiver.Realm = eRealm.Hibernia;
questGiver.CurrentRegionID = 200;
// select * from NPCEquipment where TemplateID in (select EquipmentTemplateID from Mob where name = ?)
GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 448, 0); // Slot 12
template.AddNPCEquipment(eInventorySlot.FeetArmor, 427, 0); // Slot 23
template.AddNPCEquipment(eInventorySlot.TorsoArmor, 423, 0); // Slot 25
template.AddNPCEquipment(eInventorySlot.LegsArmor, 424, 0); // Slot 27
template.AddNPCEquipment(eInventorySlot.ArmsArmor, 425, 0); // Slot 28
questGiver.Inventory = template.CloseTemplate();
questGiver.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);
questGiver.Model = 388;
questGiver.Size = 51;
questGiver.Level = 35;
questGiver.X = 346768;
questGiver.Y = 489521;
questGiver.Z = 5200;
questGiver.Heading = 2594;
if (SAVE_INTO_DATABASE)
questGiver.SaveIntoDatabase();
questGiver.AddToWorld();
}
else
questGiver = npcs[0];
npcs = WorldMgr.GetNPCsByName(questTargetName, eRealm.Hibernia);
if (npcs.Length == 0)
{
questTarget = new GameNPC();
questTarget.Name = questTargetName;
if (log.IsWarnEnabled)
log.Warn("Could not find " + questTarget.Name + ", creating him ...");
questTarget.Realm = eRealm.Hibernia;
questTarget.CurrentRegionID = 200;
// select * from NPCEquipment where TemplateID in (select EquipmentTemplateID from Mob where name = ?)
GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
template.AddNPCEquipment(eInventorySlot.HandsArmor, 411, 0); // Slot 22
template.AddNPCEquipment(eInventorySlot.FeetArmor, 412, 0); // Slot 23
template.AddNPCEquipment(eInventorySlot.TorsoArmor, 408, 0); // Slot 25
template.AddNPCEquipment(eInventorySlot.Cloak, 57, 34); // Slot 26
template.AddNPCEquipment(eInventorySlot.LegsArmor, 409, 0); // Slot 27
template.AddNPCEquipment(eInventorySlot.ArmsArmor, 410, 0); // Slot 28
questTarget.Inventory = template.CloseTemplate();
questTarget.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);
questTarget.Model = 381;
questTarget.Size = 50;
questTarget.Level = 12;
questTarget.X = 347327;
questTarget.Y = 492700;
questTarget.Z = 5199;
questTarget.Heading = 2468;
if (SAVE_INTO_DATABASE)
questTarget.SaveIntoDatabase();
questTarget.AddToWorld();
}
else
questTarget = npcs[0];
#endregion
/*
#region defineAreas
targetArea = WorldMgr.GetRegion(targetLocation.RegionID).AddArea(new Area.Circle("", targetLocation.X, targetLocation.Y, targetLocation.Z, 200));
#endregion
*/
#region defineItems
armBone = GameServer.Database.FindObjectByKey<ItemTemplate>("BonesToBlades-armbone");
if (armBone == null) {
armBone = new ItemTemplate();
armBone.Name = "Arm Bone";
if (log.IsWarnEnabled)
log.Warn("Could not find " + armBone.Name + ", creating it ...");
armBone.Level = 1;
armBone.Weight = 1;
//.........这里部分代码省略.........
示例8: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
/* First thing we do in here is to search for the NPCs inside
* the world who comes from the certain Realm. If we find a the players,
* this means we don't have to create a new one.
*
* NOTE: You can do anything you want in this method, you don't have
* to search for NPC's ... you could create a custom item, place it
* on the ground and if a player picks it up, he will get the quest!
* Just examples, do anything you like and feel comfortable with :)
*/
#region defineNPCs
masterFrederick = GetMasterFrederick();
GameNPC[] npcs = WorldMgr.GetNPCsByName("Queen Tatiana", eRealm.None);
if (npcs.Length == 0)
{
if (log.IsWarnEnabled)
log.Warn("Could not find Queen Tatiana, creating ...");
queenTatiana = new GameNPC();
queenTatiana.Name = "Queen Tatiana";
queenTatiana.X = 558500;
queenTatiana.Y = 533042;
queenTatiana.Z = 2573;
queenTatiana.Heading = 174;
queenTatiana.Model = 603;
queenTatiana.GuildName = "Part of " + questTitle + " Quest";
queenTatiana.Realm = eRealm.None;
queenTatiana.CurrentRegionID = 1;
queenTatiana.Size = 49;
queenTatiana.Level = 5;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 30;
brain.AggroRange = 600;
queenTatiana.SetOwnBrain(brain);
if (SAVE_INTO_DATABASE)
queenTatiana.SaveIntoDatabase();
queenTatiana.AddToWorld();
}
else
{
queenTatiana = (GameNPC) npcs[0];
}
int counter = 0;
foreach (GameNPC npc in queenTatiana.GetNPCsInRadius(500))
{
if (npc.Name == "ire fairy sorceress")
{
fairySorceress[counter] = (GameNPC) npc;
counter++;
}
if (counter == fairySorceress.Length)
break;
}
for (int i = 0; i < fairySorceress.Length; i++)
{
if (fairySorceress[i] == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not find ire fairy sorceress, creating ...");
fairySorceress[i] = new GameNPC();
fairySorceress[i].Model = 603; // //819;
fairySorceress[i].Name = "ire fairy sorceress";
fairySorceress[i].GuildName = "Part of " + questTitle + " Quest";
fairySorceress[i].Realm = eRealm.None;
fairySorceress[i].CurrentRegionID = 1;
fairySorceress[i].Size = 35;
fairySorceress[i].Level = 5;
fairySorceress[i].X = queenTatiana.X + Util.Random(30, 150);
fairySorceress[i].Y = queenTatiana.Y + Util.Random(30, 150);
fairySorceress[i].Z = queenTatiana.Z;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 30;
brain.AggroRange = 600;
fairySorceress[i].SetOwnBrain(brain);
fairySorceress[i].Heading = 93;
//fairySorceress[i].EquipmentTemplateID = 200276;
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
fairySorceress[i].SaveIntoDatabase();
fairySorceress[i].AddToWorld();
}
}
//.........这里部分代码省略.........
示例9: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
#region NPC Declarations
GameNPC[] npcs = WorldMgr.GetNPCsByName("Brigit", eRealm.Hibernia);
if (npcs.Length == 0)
{
if (log.IsWarnEnabled)
log.Warn("Could not find Brigit , creating it ...");
Brigit = new GameNPC();
Brigit.Model = 384;
Brigit.Name = "Brigit";
Brigit.GuildName = "";
Brigit.Realm = eRealm.Hibernia;
Brigit.CurrentRegionID = 201;
Brigit.Size = 51;
Brigit.Level = 50;
Brigit.X = 33131;
Brigit.Y = 32922;
Brigit.Z = 8008;
Brigit.Heading = 3254;
Brigit.AddToWorld();
if (SAVE_INTO_DATABASE)
{
Brigit.SaveIntoDatabase();
}
}
else
Brigit = npcs[0];
// end npc
npcs = WorldMgr.GetNPCsByName("Caithor", eRealm.None);
if (npcs.Length == 0)
{
if (log.IsWarnEnabled)
log.Warn("Could not find Caithor , creating it ...");
Caithor = new GameNPC();
Caithor.Model = 339;
Caithor.Name = "Caithor";
Caithor.GuildName = "";
Caithor.Realm = eRealm.None;
Caithor.CurrentRegionID = 200;
Caithor.Size = 60;
Caithor.Level = 65;
Caithor.X = 470547;
Caithor.Y = 531497;
Caithor.Z = 4984;
Caithor.Heading = 3319;
Caithor.AddToWorld();
if (SAVE_INTO_DATABASE)
{
Caithor.SaveIntoDatabase();
}
}
else
Caithor = npcs[0];
// end npc
#endregion
#region Item Declarations
Moonstone = GameServer.Database.FindObjectByKey<ItemTemplate>("Moonstone");
if (Moonstone == null)
{
if (log.IsWarnEnabled)
log.Warn("Could not find Moonstone , creating it ...");
Moonstone = new ItemTemplate();
Moonstone.Id_nb = "Moonstone";
Moonstone.Name = "Moonstone";
Moonstone.Level = 8;
Moonstone.Item_Type = 29;
Moonstone.Model = 514;
Moonstone.IsDropable = false;
Moonstone.IsPickable = false;
Moonstone.DPS_AF = 0;
Moonstone.SPD_ABS = 0;
Moonstone.Object_Type = 41;
Moonstone.Hand = 0;
Moonstone.Type_Damage = 0;
Moonstone.Quality = 100;
Moonstone.Weight = 12;
if (SAVE_INTO_DATABASE)
{
GameServer.Database.AddObject(Moonstone);
}
}
// end item
BardEpicBoots = GameServer.Database.FindObjectByKey<ItemTemplate>("BardEpicBoots");
if (BardEpicBoots == null)
//.........这里部分代码省略.........
示例10: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
#region defineNPCs
GameNPC[] npcs;
npcs = WorldMgr.GetNPCsByName("Sir Quait", (eRealm)1);
if (npcs.Length == 0)
{
SirQuait = new DOL.GS.GameNPC();
SirQuait.Model = 40;
SirQuait.Name = "Sir Quait";
if (log.IsWarnEnabled)
log.Warn("Could not find " + SirQuait.Name + ", creating ...");
SirQuait.GuildName = "Part of " + questTitle + " Quest";
SirQuait.Realm = eRealm.Albion;
SirQuait.CurrentRegionID = 1;
SirQuait.Size = 50;
SirQuait.Level = 10;
SirQuait.MaxSpeedBase = 100;
SirQuait.Faction = FactionMgr.GetFactionByID(0);
SirQuait.X = 531971;
SirQuait.Y = 478955;
SirQuait.Z = 0;
SirQuait.Heading = 3570;
SirQuait.RespawnInterval = 0;
SirQuait.BodyType = 0;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 0;
brain.AggroRange = 0;
SirQuait.SetOwnBrain(brain);
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
SirQuait.SaveIntoDatabase();
SirQuait.AddToWorld();
}
else
{
SirQuait = npcs[0];
}
npcs = WorldMgr.GetNPCsByName("Evil Thief of the Shadowclan", (eRealm)0);
if (npcs.Length == 0)
{
EvilThiefoftheShadowclan = new DOL.GS.GameNPC();
EvilThiefoftheShadowclan.Model = 55;
EvilThiefoftheShadowclan.Name = "Evil Thief of the Shadowclan";
if (log.IsWarnEnabled)
log.Warn("Could not find " + EvilThiefoftheShadowclan.Name + ", creating ...");
EvilThiefoftheShadowclan.GuildName = "Part of " + questTitle + " Quest";
EvilThiefoftheShadowclan.Realm = eRealm.None;
EvilThiefoftheShadowclan.CurrentRegionID = 1;
EvilThiefoftheShadowclan.Size = 50;
EvilThiefoftheShadowclan.Level = 1;
EvilThiefoftheShadowclan.MaxSpeedBase = 100;
EvilThiefoftheShadowclan.Faction = FactionMgr.GetFactionByID(0);
EvilThiefoftheShadowclan.X = 532571;
EvilThiefoftheShadowclan.Y = 479055;
EvilThiefoftheShadowclan.Z = 2200;
EvilThiefoftheShadowclan.Heading = 3570;
EvilThiefoftheShadowclan.RespawnInterval = 0;
EvilThiefoftheShadowclan.BodyType = 0;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 0;
brain.AggroRange = 0;
EvilThiefoftheShadowclan.SetOwnBrain(brain);
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
EvilThiefoftheShadowclan.SaveIntoDatabase();
EvilThiefoftheShadowclan.AddToWorld();
}
else
{
EvilThiefoftheShadowclan = npcs[0];
}
#endregion defineNPCs
#region defineItems
SirQuaitsSword = GameServer.Database.FindObjectByKey<ItemTemplate>("SirQuaitsSword");
if (SirQuaitsSword == null)
{
SirQuaitsSword = new ItemTemplate();
SirQuaitsSword.Name = "Sir Quait's Sword";
//.........这里部分代码省略.........
示例11: Notify
public override void Notify(DOLEvent e, object sender, EventArgs args)
{
GamePlayer player = sender as GamePlayer;
if (player == null || player.IsDoingQuest(typeof(HeartOfSephucoth)) == null)
return;
if (e == GameLivingEvent.EnemyKilled)
{
EnemyKilledEventArgs gArgs = (EnemyKilledEventArgs)args;
if (Step == 1)
{
if (gArgs.Target.Name == "river sprite")
{
if (Util.Chance(25))
{
if (sephucoth == null)
{
sephucoth = new GameNPC();
sephucoth.Model = 136;
sephucoth.Name = "Sephucoth";
sephucoth.Realm = eRealm.None;
sephucoth.CurrentRegionID = 1;
sephucoth.Size = 55;
sephucoth.Level = 7;
sephucoth.X = 560836;
sephucoth.Y = 527260;
sephucoth.Z = 2082;
sephucoth.Heading = 1480;
StandardMobBrain brain = new StandardMobBrain(); // set a brain witch find a lot mob friend to attack the player
sephucoth.SetOwnBrain(brain); // so this mob must be abble to cast
sephucoth.RespawnInterval = 0; // don't respawn when killed
sephucoth.AddToWorld();
}
}
}
else if (gArgs.Target.Name == "Sephucoth")
{
GiveItem(gArgs.Target, player, sephucothsHeart);
if (sephucoth != null) { sephucoth = null; }
Step = 2;
}
}
else if (Step == 3)
{
if (gArgs.Target.Name == "large skeleton")
{
if (Util.Chance(50))
{
GiveItem(gArgs.Target, player, polishedBone);
Step = 4;
}
}
}
}
else if (e == GamePlayerEvent.GiveItem)
{
GiveItemEventArgs gArgs = (GiveItemEventArgs)args;
if (gArgs.Target.Name == eowylnAstos.Name)
{
if (gArgs.Item.Id_nb == sephucothsHeart.Id_nb && Step == 2)
{
RemoveItem(eowylnAstos, m_questPlayer, sephucothsHeart);
eowylnAstos.TurnTo(m_questPlayer);
eowylnAstos.SayTo(m_questPlayer, "You have done well traveler! I will still require one final object to complete the pendant. Seek out a large skeleton and bring from it a piece of polished bone! Return this to me and I shall finish your pendant.");
Step = 3;
}
else if (gArgs.Item.Id_nb == polishedBone.Id_nb && Step == 4)
{
RemoveItem(eowylnAstos, m_questPlayer, polishedBone);
eowylnAstos.TurnTo(m_questPlayer);
eowylnAstos.SayTo(m_questPlayer, "Eowyln draws two items before her. Gathering her strength, she shouts.");
new RegionTimer(eowylnAstos, new RegionTimerCallback(BuildNecklace), 5000);
}
}
}
}
示例12: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
/* First thing we do in here is to search for the NPCs inside
* the world who comes from the certain Realm. If we find a the players,
* this means we don't have to create a new one.
*
* NOTE: You can do anything you want in this method, you don't have
* to search for NPC's ... you could create a custom item, place it
* on the ground and if a player picks it up, he will get the quest!
* Just examples, do anything you like and feel comfortable with :)
*/
#region defineNPCS
GameNPC[] npcs = WorldMgr.GetNPCsByName("Eowyln Astos", eRealm.Albion);
/* Whops, if the npcs array length is 0 then no npc exists in
* this users Mob Database, so we simply create one ;-)
* else we take the existing one. And if more than one exist, we take
* the first ...
*/
if (npcs.Length == 0)
{
eowylnAstos = new GameNPC();
eowylnAstos.Model = 35;
eowylnAstos.Name = "Eowyln Astos";
if (log.IsWarnEnabled)
log.Warn("Could not find " + eowylnAstos.Name + ", creating him ...");
eowylnAstos.GuildName = "Part of " + questTitle + " Quest";
eowylnAstos.Realm = eRealm.Albion;
eowylnAstos.CurrentRegionID = 1;
GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
template.AddNPCEquipment(eInventorySlot.TorsoArmor, 58, 40);
eowylnAstos.Inventory = template.CloseTemplate();
eowylnAstos.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);
eowylnAstos.Size = 54;
eowylnAstos.Level = 17;
eowylnAstos.X = 559680;
eowylnAstos.Y = 513793;
eowylnAstos.Z = 2619;
eowylnAstos.Heading = 3185;
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
eowylnAstos.SaveIntoDatabase();
eowylnAstos.AddToWorld();
}
else
eowylnAstos = npcs[0];
#endregion defineNPCS
#region defineItems
// item db check
sephucothsHeart = GameServer.Database.FindObjectByKey<ItemTemplate>("sephucoths_heart");
if (sephucothsHeart == null)
{
sephucothsHeart = new ItemTemplate();
sephucothsHeart.Name = "Sephucoth's Heart";
if (log.IsWarnEnabled)
log.Warn("Could not find " + sephucothsHeart.Name + ", creating it ...");
sephucothsHeart.Level = 0;
sephucothsHeart.Weight = 0;
sephucothsHeart.Model = 595;
sephucothsHeart.Object_Type = (int)eObjectType.GenericItem;
sephucothsHeart.Id_nb = "sephucoths_heart";
sephucothsHeart.Price = 0;
sephucothsHeart.IsPickable = false;
sephucothsHeart.IsDropable = false;
sephucothsHeart.Quality = 100;
sephucothsHeart.Condition = 1000;
sephucothsHeart.MaxCondition = 1000;
sephucothsHeart.Durability = 1000;
sephucothsHeart.MaxDurability = 1000;
//You don't have to store the created item in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
GameServer.Database.AddObject(sephucothsHeart);
}
// item db check
polishedBone = GameServer.Database.FindObjectByKey<ItemTemplate>("polished_bone");
if (polishedBone == null)
{
polishedBone = new ItemTemplate();
//.........这里部分代码省略.........
示例13: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
#region defineNPCs
GameNPC[] npcs;
npcs = WorldMgr.GetNPCsByName("Aegan",(eRealm) 2);
if (npcs.Length == 0)
{
Aegan = new DOL.GS.GameNPC();
Aegan.Model = 232;
Aegan.Name = "Aegan";
if (log.IsWarnEnabled)
log.Warn("Could not find " + Aegan.Name + ", creating ...");
Aegan.GuildName = "Part of " + questTitle + " Quest";
Aegan.Realm = eRealm.Midgard;
Aegan.CurrentRegionID = 100;
Aegan.Size = 51;
Aegan.Level = 41;
Aegan.MaxSpeedBase = 191;
Aegan.Faction = FactionMgr.GetFactionByID(0);
Aegan.X = 805398;
Aegan.Y = 725829;
Aegan.Z = 4700;
Aegan.Heading = 3595;
Aegan.RespawnInterval = -1;
Aegan.BodyType = 0;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 0;
brain.AggroRange = 500;
Aegan.SetOwnBrain(brain);
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
Aegan.SaveIntoDatabase();
Aegan.AddToWorld();
}
else
{
Aegan = npcs[0];
}
#endregion
#region defineItems
clawofblackmauler = GameServer.Database.FindObjectByKey<ItemTemplate>("clawofblackmauler");
if (clawofblackmauler == null)
{
clawofblackmauler = new ItemTemplate();
clawofblackmauler.Name = "Claw of Black Mauler";
if (log.IsWarnEnabled)
log.Warn("Could not find " + clawofblackmauler.Name + ", creating it ...");
clawofblackmauler.Level = 50;
clawofblackmauler.Weight = 5;
clawofblackmauler.Model = 1;
clawofblackmauler.Object_Type = 0;
clawofblackmauler.Item_Type = 40;
clawofblackmauler.Id_nb = "clawofblackmauler";
clawofblackmauler.Hand = 0;
clawofblackmauler.Price = 0;
clawofblackmauler.IsPickable = true;
clawofblackmauler.IsDropable = true;
clawofblackmauler.IsTradable = true;
clawofblackmauler.CanDropAsLoot = false;
clawofblackmauler.Color = 0;
clawofblackmauler.Bonus = 35; // default bonus
clawofblackmauler.Bonus1 = 0;
clawofblackmauler.Bonus1Type = (int) 0;
clawofblackmauler.Bonus2 = 0;
clawofblackmauler.Bonus2Type = (int) 0;
clawofblackmauler.Bonus3 = 0;
clawofblackmauler.Bonus3Type = (int) 0;
clawofblackmauler.Bonus4 = 0;
clawofblackmauler.Bonus4Type = (int) 0;
clawofblackmauler.Bonus5 = 0;
clawofblackmauler.Bonus5Type = (int) 0;
clawofblackmauler.Bonus6 = 0;
clawofblackmauler.Bonus6Type = (int) 0;
clawofblackmauler.Bonus7 = 0;
clawofblackmauler.Bonus7Type = (int) 0;
clawofblackmauler.Bonus8 = 0;
clawofblackmauler.Bonus8Type = (int) 0;
clawofblackmauler.Bonus9 = 0;
clawofblackmauler.Bonus9Type = (int) 0;
clawofblackmauler.Bonus10 = 0;
clawofblackmauler.Bonus10Type = (int) 0;
clawofblackmauler.ExtraBonus = 0;
clawofblackmauler.ExtraBonusType = (int) 0;
clawofblackmauler.Effect = 0;
clawofblackmauler.Emblem = 0;
//.........这里部分代码省略.........
示例14: CreateBriediClone
protected void CreateBriediClone()
{
GameNpcInventoryTemplate template;
if (briediClone == null)
{
briediClone = new GameNPC();
briediClone.Model = 157;
briediClone.Name = "Master Briedi";
briediClone.GuildName = "Part of " + questTitle + " Quest";
briediClone.Realm = eRealm.Midgard;
briediClone.CurrentRegionID = 100;
briediClone.Size = 50;
briediClone.Level = 45;
briediClone.X = GameLocation.ConvertLocalXToGlobalX(45394, 100);
briediClone.Y = GameLocation.ConvertLocalYToGlobalY(39768, 100);
briediClone.Z = 4709;
briediClone.Heading = 107;
template = new GameNpcInventoryTemplate();
template.AddNPCEquipment(eInventorySlot.TorsoArmor, 348);
template.AddNPCEquipment(eInventorySlot.LegsArmor, 349);
template.AddNPCEquipment(eInventorySlot.ArmsArmor, 350);
template.AddNPCEquipment(eInventorySlot.HandsArmor, 351);
template.AddNPCEquipment(eInventorySlot.FeetArmor, 352);
template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 640);
briediClone.Inventory = template.CloseTemplate();
briediClone.SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
// briediClone.AddNPCEquipment((byte) eEquipmentItems.TORSO, 348, 0, 0, 0);
// briediClone.AddNPCEquipment((byte) eEquipmentItems.LEGS, 349, 0, 0, 0);
// briediClone.AddNPCEquipment((byte) eEquipmentItems.ARMS, 350, 0, 0, 0);
// briediClone.AddNPCEquipment((byte) eEquipmentItems.HAND, 351, 0, 0, 0);
// briediClone.AddNPCEquipment((byte) eEquipmentItems.FEET, 352, 0, 0, 0);
// briediClone.AddNPCEquipment((byte) eEquipmentItems.TWO_HANDED, 640, 0, 0, 0);
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 0;
brain.AggroRange = 0;
briediClone.SetOwnBrain(brain);
briediClone.AddToWorld();
GameEventMgr.AddHandler(briediClone, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterBriedi));
GameEventMgr.AddHandler(briediClone, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterBriedi));
}
else
{
briediClone.MoveTo(100, GameLocation.ConvertLocalXToGlobalX(45394, 100), GameLocation.ConvertLocalYToGlobalY(39768, 100), 4709, 107);
}
foreach (GamePlayer visPlayer in briediClone.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
{
visPlayer.Out.SendEmoteAnimation(briediClone, eEmote.Bind);
}
for (int i = 0; i < recruits.Length; i++)
{
recruits[i] = new GameNPC();
recruits[i].Name = "Recruit";
recruits[i].GuildName = "Part of " + questTitle + " Quest";
recruits[i].Realm = eRealm.Midgard;
recruits[i].CurrentRegionID = briediClone.CurrentRegionID;
recruits[i].Size = 50;
recruits[i].Level = 6;
recruits[i].X = briediClone.X + Util.Random(-150, 150);
recruits[i].Y = briediClone.Y + Util.Random(-150, 150);
recruits[i].Z = briediClone.Z;
recruits[i].Heading = 187;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 0;
brain.AggroRange = 0;
recruits[i].SetOwnBrain(brain);
}
recruits[0].Name = "Recruit Hietan";
recruits[0].Model = 189;
template = new GameNpcInventoryTemplate();
template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 69);
template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
recruits[0].Inventory = template.CloseTemplate();
recruits[0].SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);
// recruits[0].AddNPCEquipment((byte) eEquipmentItems.TWO_HANDED, 69, 0, 0, 0);
// recruits[0].AddNPCEquipment((byte) eEquipmentItems.TORSO, 46, 0, 0, 0);
// recruits[0].AddNPCEquipment((byte) eEquipmentItems.LEGS, 47, 0, 0, 0);
// recruits[0].AddNPCEquipment((byte) eEquipmentItems.FEET, 50, 0, 0, 0);
// recruits[0].AddNPCEquipment((byte) eEquipmentItems.ARMS, 48, 0, 0, 0);
// recruits[0].AddNPCEquipment((byte) eEquipmentItems.HAND, 49, 0, 0, 0);
recruits[1].Name = "Recruit Iduki";
//.........这里部分代码省略.........
示例15: ScriptLoaded
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
if (!ServerProperties.Properties.LOAD_QUESTS)
return;
if (log.IsInfoEnabled)
log.Info("Quest \"" + questTitle + "\" initializing ...");
#region defineNPCs
GameNPC[] npcs;
npcs = WorldMgr.GetNPCsByName("Lycla",(eRealm) 2);
if (npcs.Length == 0)
{
Lycla = new DOL.GS.GameNPC();
Lycla.Model = 178;
Lycla.Name = "Lycla";
if (log.IsWarnEnabled)
log.Warn("Could not find " + Lycla.Name + ", creating ...");
Lycla.GuildName = "Part of " + questTitle + " Quest";
Lycla.Realm = eRealm.Midgard;
Lycla.CurrentRegionID = 100;
Lycla.Size = 48;
Lycla.Level = 50;
Lycla.MaxSpeedBase = 191;
Lycla.Faction = FactionMgr.GetFactionByID(0);
Lycla.X = 749032;
Lycla.Y = 814613;
Lycla.Z = 4408;
Lycla.Heading = 170;
Lycla.RespawnInterval = -1;
Lycla.BodyType = 0;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 0;
brain.AggroRange = 500;
Lycla.SetOwnBrain(brain);
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
Lycla.SaveIntoDatabase();
Lycla.AddToWorld();
}
else
{
Lycla = npcs[0];
}
npcs = WorldMgr.GetNPCsByName("Amora",(eRealm) 2);
if (npcs.Length == 0)
{
Amora = new DOL.GS.GameNPC();
Amora.Model = 216;
Amora.Name = "Amora";
if (log.IsWarnEnabled)
log.Warn("Could not find " + Amora.Name + ", creating ...");
Amora.GuildName = "Part of " + questTitle + " Quest";
Amora.Realm = eRealm.Midgard;
Amora.CurrentRegionID = 100;
Amora.Size = 49;
Amora.Level = 28;
Amora.MaxSpeedBase = 191;
Amora.Faction = FactionMgr.GetFactionByID(0);
Amora.X = 747714;
Amora.Y = 814910;
Amora.Z = 4636;
Amora.Heading = 3456;
Amora.RespawnInterval = -1;
Amora.BodyType = 0;
StandardMobBrain brain = new StandardMobBrain();
brain.AggroLevel = 0;
brain.AggroRange = 500;
Amora.SetOwnBrain(brain);
//You don't have to store the created mob in the db if you don't want,
//it will be recreated each time it is not found, just comment the following
//line if you rather not modify your database
if (SAVE_INTO_DATABASE)
Amora.SaveIntoDatabase();
Amora.AddToWorld();
}
else
{
Amora = npcs[0];
}
npcs = WorldMgr.GetNPCsByName("Kari",(eRealm) 2);
if (npcs.Length == 0)
{
Kari = new GameHealer();
Kari.Model = 216;
Kari.Name = "Kari";
if (log.IsWarnEnabled)
log.Warn("Could not find " + Kari.Name + ", creating ...");
//.........这里部分代码省略.........