psu_npc: Make sure the NPC level doesn't go below 1 or above 200.
This commit is contained in:
parent
79d36e5313
commit
d1a30ecc63
@ -33,6 +33,13 @@ user_init(NPCid, BaseLevel) ->
|
||||
UCS2Name = << TmpUCS2Name/binary, 0:PaddingSize >>,
|
||||
#psu_npc{race=Race, gender=Gender, class=Class, level=LevelDiff, appearance=Appearance} = Settings,
|
||||
Character = #characters{gid=NPCGID, slot=0, type=npc, npcid=NPCid, name=UCS2Name, race=Race, gender=Gender, class=Class, appearance=Appearance,
|
||||
mainlevel={level, BaseLevel + LevelDiff, 0}, blastbar=0, luck=2, money=0, playtime=0, stats={stats, 0, 0, 0, 0, 0, 0, 0}, se=[], currenthp=100, maxhp=100},
|
||||
mainlevel={level, calc_level(BaseLevel, LevelDiff), 0}, blastbar=0, luck=2, money=0, playtime=0, stats={stats, 0, 0, 0, 0, 0, 0, 0}, se=[], currenthp=100, maxhp=100},
|
||||
#egs_user_model{id=NPCGID, state=online, character=Character, areatype=lobby, area={psu_area, 0, 0, 0}, entryid=0,
|
||||
prev_area={psu_area, 0, 0, 0}, prev_entryid=0, pos={pos, 0.0, 0.0, 0.0, 0.0}}.
|
||||
|
||||
calc_level(BaseLevel, LevelDiff) ->
|
||||
TmpLevel = BaseLevel + LevelDiff,
|
||||
if TmpLevel < 1 -> 1;
|
||||
TmpLevel > 200 -> 200;
|
||||
true -> TmpLevel
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user