Created
January 21, 2011 07:20
-
-
Save Konctantin/789363 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creature c = new Creature(); | |
CreatureAddon ca = new CreatureAddon(); | |
CreatureTemplate ct = new CreatureTemplate(); | |
CreatureModelInfo cmi = new CreatureModelInfo(); | |
var splin = mInfo.Spline.Splines; | |
c.map = obj.Map; | |
c.phaseMask = obj.Phase; | |
c.coord = mInfo.Position; | |
c.o = mInfo.Facing; | |
ca.Spline = (uint)mInfo.Spline.Flags; | |
c.guid = ca.Guid = obj.WowGuid.Counter; | |
c.id = ct.Entry = obj.Entry; | |
c.modelid = cmi.modelid = obj.GetUIntValue(UnitUpdateFields.UNIT_FIELD_DISPLAYID); | |
c.curhealth = ct.maxhealth = obj.GetUIntValue(UnitUpdateFields.UNIT_FIELD_MAXHEALTH); | |
c.curmana = ct.maxmana = obj.GetUIntValue(UnitUpdateFields.UNIT_FIELD_MAXPOWER1); | |
ct.faction_H = ct.faction_A = obj.GetUIntValue(UnitUpdateFields.UNIT_FIELD_FACTIONTEMPLATE); | |
ct.baseattacktime = obj.GetUIntLowValue(UnitUpdateFields.UNIT_FIELD_BASEATTACKTIME); | |
ct.rangeattacktime = obj.GetUIntValue(UnitUpdateFields.UNIT_FIELD_BASEATTACKTIME); | |
ct.unit_class = obj.GetByteValue(UnitUpdateFields.UNIT_FIELD_BYTES_0, 1); | |
ct.NpcFlag = obj.GetUIntValue(UnitUpdateFields.UNIT_NPC_FLAGS); | |
ca.Bytes1 = obj.GetUIntValue(UnitUpdateFields.UNIT_FIELD_BYTES_1); | |
ca.Bytes2 = obj.GetUIntValue(UnitUpdateFields.UNIT_FIELD_BYTES_2); | |
ca.Emote = obj.GetUIntValue(UnitUpdateFields.UNIT_NPC_EMOTESTATE); | |
ca.Mount = obj.GetUIntValue(UnitUpdateFields.UNIT_FIELD_MOUNTDISPLAYID); | |
cmi.boundingradius = obj.GetFloatValue(UnitUpdateFields.UNIT_FIELD_BOUNDINGRADIUS); | |
cmi.combatreach = obj.GetFloatValue(UnitUpdateFields.UNIT_FIELD_COMBATREACH); | |
ct.VehicleId = mInfo.VehicleId; | |
if(ct.NpcFlag == 0) | |
c.MovementType = 1; | |
if (splin.Count > 1) | |
c.MovementType = 2; | |
sb.AppendLine(ct.ToString()); | |
sb.AppendLine(c.ToString()); | |
sb.AppendLine(cmi.ToString()); | |
sb.AppendLine(ca.ToString()); | |
if (splin.Count > 1) | |
{ | |
sb.AppendLine("REPLACE INTO `creature_movement` (`id`, `point`, `position_x`, `position_y`, `position_z`) VALUES"); | |
for (int i = 0; i < splin.Count; ++i) | |
sb.AppendFormatLine("({0}, {1}, {2:F5}, {3:F5}, {4:F5}){5}", | |
c.guid, i+1, splin[i].X, splin[i].Y, splin[i].Z, (i < splin.Count - 1 ? "," : ";")); | |
} | |
sb.AppendLine(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment