Browse Source

Charm person spell

Bob Mottram 2 months ago
parent
commit
d50f3a07c1
10 changed files with 308 additions and 37 deletions
  1. 25 17
      abermush.py
  2. 23 1
      combat.py
  3. 27 16
      commands.py
  4. 204 0
      def/npcs.json
  5. 15 1
      def/spells.json
  6. 4 0
      events.py
  7. 1 1
      functions.py
  8. 4 0
      playerconnections.py
  9. 1 1
      players/Guest.player
  10. 4 0
      players/player.template

+ 25 - 17
abermush.py

@@ -35,6 +35,7 @@ from combat import runFights
 from combat import playersRest
 from combat import updateTemporaryHitPoints
 from combat import updateTemporaryIncapacitation
+from combat import updateTemporaryCharm
 from playerconnections import runPlayerConnections
 from playerconnections import disconnectIdlePlayers
 from npcs import npcRespawns
@@ -233,6 +234,7 @@ for k in npcsDB:
                v == "proficiencies" or
                v == "fightingStyle" or
                v == "enemy" or
+               v == "tempCharmTarget" or
                v == "guild" or
                v == "guildRole" or
                v == "affinity" or
@@ -439,6 +441,8 @@ while True:
         updateTemporaryHitPoints(mud, npcs, True)
         updateTemporaryIncapacitation(mud, players, False)
         updateTemporaryIncapacitation(mud, npcs, True)
+        updateTemporaryCharm(mud, players, False)
+        updateTemporaryCharm(mud, npcs, True)
 
     now = int(time.time())
     if now >= lastWeatherUpdate + weatherUpdateInterval:
@@ -483,7 +487,7 @@ while True:
                 playersDB = loadPlayersDB()
                 # State Save logic End
                 lastStateSave = now
-        saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+        saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
         lastStateSave = now
 
     # Handle Player Deaths
@@ -895,22 +899,26 @@ while True:
                     players[id]['fightingStyle'] = dbResponse[62]
                     players[id]['restRequired'] = dbResponse[63]
                     players[id]['enemy'] = dbResponse[64]
-                    players[id]['guild'] = dbResponse[65]
-                    players[id]['guildRole'] = dbResponse[66]
-                    players[id]['archetype'] = dbResponse[67]
-                    players[id]['preparedSpells'] = dbResponse[68]
-                    players[id]['spellSlots'] = dbResponse[69]
-                    players[id]['tempHitPoints'] = dbResponse[70]
-                    players[id]['tempHitPointsStart'] = dbResponse[71]
-                    players[id]['tempHitPointsDuration'] = dbResponse[72]
-                    players[id]['prepareSpell'] = dbResponse[73]
-                    players[id]['prepareSpellProgress'] = dbResponse[74]
-                    players[id]['prepareSpellTime'] = dbResponse[75]
-                    players[id]['frozenDescription'] = dbResponse[76]
-                    players[id]['frozenStart'] = dbResponse[77]
-                    players[id]['frozenDuration'] = dbResponse[78]
-                    players[id]['affinity'] = dbResponse[79]
-                    players[id]['familiar'] = dbResponse[80]
+                    players[id]['tempCharm'] = dbResponse[65]
+                    players[id]['tempCharmTarget'] = dbResponse[66]
+                    players[id]['tempCharmDuration'] = dbResponse[67]
+                    players[id]['tempCharmStart'] = dbResponse[68]
+                    players[id]['guild'] = dbResponse[69]
+                    players[id]['guildRole'] = dbResponse[70]
+                    players[id]['archetype'] = dbResponse[71]
+                    players[id]['preparedSpells'] = dbResponse[72]
+                    players[id]['spellSlots'] = dbResponse[73]
+                    players[id]['tempHitPoints'] = dbResponse[74]
+                    players[id]['tempHitPointsStart'] = dbResponse[75]
+                    players[id]['tempHitPointsDuration'] = dbResponse[76]
+                    players[id]['prepareSpell'] = dbResponse[77]
+                    players[id]['prepareSpellProgress'] = dbResponse[78]
+                    players[id]['prepareSpellTime'] = dbResponse[79]
+                    players[id]['frozenDescription'] = dbResponse[80]
+                    players[id]['frozenStart'] = dbResponse[81]
+                    players[id]['frozenDuration'] = dbResponse[82]
+                    players[id]['affinity'] = dbResponse[83]
+                    players[id]['familiar'] = dbResponse[84]
 
                     log("Client ID: " +
                         str(id) +

+ 23 - 1
combat.py

@@ -63,7 +63,7 @@ def updateTemporaryHitPoints(mud, players, isNPC):
            players[p]['tempHitPointsDuration'] > 0:
             players[p]['tempHitPointsStart'] = now
         else:
-            if now >= players[p]['tempHitPointsStart'] + \
+            if now > players[p]['tempHitPointsStart'] + \
                     players[p]['tempHitPointsDuration']:
                 players[p]['tempHitPoints'] = 0
                 players[p]['tempHitPointsStart'] = 0
@@ -72,6 +72,28 @@ def updateTemporaryHitPoints(mud, players, isNPC):
                     mud.send_message(
                         p, "<f220>Your magical protection expires.<r>\n\n")
 
+def updateTemporaryCharm(mud, players, isNPC):
+    """Updates any charm added for a temporary period
+       as the result of a spell
+    """
+    now = int(time.time())
+    for p in players:
+        if players[p]['tempCharm'] == 0:
+            continue
+        if players[p]['tempCharmStart'] == 0 and \
+           players[p]['tempCharmDuration'] > 0:
+            players[p]['tempCharmStart'] = now
+        else:
+            if now > players[p]['tempCharmStart'] + \
+                    players[p]['tempCharmDuration']:
+                players[p]['tempCharmStart'] = 0
+                players[p]['tempCharmDuration'] = 0
+                if players[p]['affinity'].get(players[p]['tempCharmTarget']):
+                    players[p]['affinity'][players[p]['tempCharmTarget']]-=players[p]['tempCharm']
+                players[p]['tempCharm'] = 0
+                if not isNPC:
+                    mud.send_message(
+                        p, "<f220>A charm spell wears off.<r>\n\n")
 
 def playersRest(mud, players):
     """Rest restores hit points

+ 27 - 16
commands.py

@@ -645,7 +645,7 @@ def shutdown(
         return
 
     mud.send_message(id, "\n\nShutdown commenced.\n\n")
-    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
     mud.send_message(id, "\n\nUniverse saved.\n\n")
     log("Universe saved", "info")
     for (pid, pl) in list(players.items()):
@@ -1210,10 +1210,21 @@ def castSpellOnPlayer(mud, spellName, players, id, npcs, p, spellDetails):
 
     if spellDetails['action'].startswith('protect'):
         npcs[p]['tempHitPoints'] = spellDetails['hp']
-        npcs[p]['tempHitPointsDuration'] = spellTimeToSec(
-            spellDetails['duration'])
+        npcs[p]['tempHitPointsDuration'] = spellTimeToSec(spellDetails['duration'])
         npcs[p]['tempHitPointsStart'] = int(time.time())
 
+    if spellDetails['action'].startswith('charm'):
+        charmTarget=players[id]['name']
+        charmValue=int(npcs[p]['cha'] + players[id]['cha'])
+        npcs[p]['tempCharm'] = charmValue
+        npcs[p]['tempCharmTarget'] = charmTarget
+        npcs[p]['tempCharmDuration'] = spellTimeToSec(spellDetails['duration'])
+        npcs[p]['tempCharmStart'] = int(time.time())
+        if npcs[p]['affinity'].get(charmTarget):
+            npcs[p]['affinity'][charmTarget]+=charmValue
+        else:
+            npcs[p]['affinity'][charmTarget]=charmValue
+
     if spellDetails['action'].startswith('friend'):
         if players[id]['cha'] < npcs[p]['cha']:
             removePreparedSpell(players, id, spellName)
@@ -2460,7 +2471,7 @@ def describe(
     if len(descriptionStrings) == 1:
         rooms[rm]['description'] = descriptionStrings[0]
         mud.send_message(id, 'Room description set.\n\n')
-        saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+        saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
         return
 
     if len(descriptionStrings) == 2:
@@ -2482,13 +2493,13 @@ def describe(
                 'Room name changed to ' +
                 thingDescription +
                 '.\n\n')
-            saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+            saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
             return
 
         if thingDescribed == 'tide':
             rooms[rm]['tideOutDescription'] = thingDescription
             mud.send_message(id, 'Tide out description set.\n\n')
-            saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+            saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
             return
 
         # change the description of an item in the room
@@ -2504,7 +2515,7 @@ def describe(
                                      itemsDB[items[item]['id']]['name'] +
                                      '.\n\n')
                     saveUniverse(
-                        rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+                        rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
                     return
 
         # Change the description of an NPC in the room
@@ -2518,7 +2529,7 @@ def describe(
                         npcs[nid]['name'] +
                         '.\n\n')
                     saveUniverse(
-                        rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+                        rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
                     return
 
     if len(descriptionStrings) == 3:
@@ -2547,7 +2558,7 @@ def describe(
                                      itemsDB[items[item]['id']]['name'] +
                                      '.\n\n')
                     saveUniverse(
-                        rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+                        rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
                     return
 
         # Change the name of an NPC in the room
@@ -2561,7 +2572,7 @@ def describe(
                         npcs[nid]['name'] +
                         '.\n\n')
                     saveUniverse(
-                        rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+                        rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
                     return
 
 
@@ -3602,7 +3613,7 @@ def conjureRoom(
     mapArea = assignCoordinates(rooms)
 
     log("New room: " + roomID, 'info')
-    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
     mud.send_message(id, 'Room created.\n\n')
 
 
@@ -3673,7 +3684,7 @@ def conjureItem(
         mud.send_message(id, itemsDB[itemID]['article'] + ' ' +
                          itemsDB[itemID]['name'] +
                          ' spontaneously materializes in front of you.\n\n')
-        saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+        saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
         return True
     return False
 
@@ -3885,7 +3896,7 @@ def conjureNPC(
             ', spontaneously appears.\n\n')
     else:
         mud.send_message(id, npcName + ' spontaneously appears.\n\n')
-    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
     return True
 
 
@@ -4075,7 +4086,7 @@ def destroyItem(
     del items[item]
     log("Item destroyed: " + destroyedName +
         ' in ' + players[id]['room'], 'info')
-    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
     return True
 
 
@@ -4126,7 +4137,7 @@ def destroyNPC(
     del npcsDB[npcID]
     log("NPC destroyed: " + destroyedName +
         ' in ' + players[id]['room'], 'info')
-    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
     return True
 
 
@@ -4194,7 +4205,7 @@ def destroyRoom(
     mapArea = assignCoordinates(rooms)
 
     log("Room destroyed: " + roomToDestroyID, 'info')
-    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env)
+    saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB)
     mud.send_message(id, "Room destroyed.\n\n")
     return True
 

+ 204 - 0
def/npcs.json

@@ -24,6 +24,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -108,6 +112,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -192,6 +200,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -292,6 +304,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -374,6 +390,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -453,6 +473,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -537,6 +561,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -622,6 +650,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -703,6 +735,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -785,6 +821,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -878,6 +918,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -972,6 +1016,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1056,6 +1104,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1154,6 +1206,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1238,6 +1294,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1325,6 +1385,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1405,6 +1469,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1435,6 +1503,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1516,6 +1588,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1596,6 +1672,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1626,6 +1706,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1708,6 +1792,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1792,6 +1880,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1874,6 +1966,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -1956,6 +2052,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2038,6 +2138,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2133,6 +2237,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2218,6 +2326,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2299,6 +2411,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2386,6 +2502,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2466,6 +2586,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2556,6 +2680,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2638,6 +2766,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2720,6 +2852,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2805,6 +2941,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2884,6 +3024,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -2966,6 +3110,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3048,6 +3196,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3133,6 +3285,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3212,6 +3368,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3297,6 +3457,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3379,6 +3543,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3461,6 +3629,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3543,6 +3715,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3625,6 +3801,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3707,6 +3887,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3804,6 +3988,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3883,6 +4071,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -3971,6 +4163,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -4055,6 +4251,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},
@@ -4153,6 +4353,10 @@
         "fightingStyle": "",
         "restRequired": 0,
         "enemy": "",
+        "tempCharmStart": 0,
+        "tempCharmDuration": 0,
+        "tempCharm": 0,
+        "tempCharmTarget": "",
         "guild": "",
         "guildRole": "",
         "affinity": {},

+ 15 - 1
def/spells.json

@@ -61,7 +61,7 @@
         "find familiar": {
     	    "description": "Your familiar appears",
 	    "description_second": "A familiar of {} appears",
-	    "prepareTime": "1 min",
+	    "prepareTime": "1 hour",
 	    "duration": "",
 	    "classes": ["druid","sorcerer","witch"],
 	    "range": 10,
@@ -72,6 +72,20 @@
 	    "action": "familiar",
 	    "actionDescription": ""
 	},
+        "charm person": {
+    	    "description": "You charm {}",
+	    "description_second": "",
+	    "prepareTime": "1 hour",
+	    "duration": "1 hour",
+	    "classes": ["druid","sorcerer","witch"],
+	    "range": 30,
+	    "items": [702],
+	    "damage": 0,
+	    "damageType": "",
+	    "hp": 0,
+	    "action": "charm",
+	    "actionDescription": ""
+	},
         "cat nap": {
     	    "description": "{} feels drowsy|{} is sleepy|{} begins to snore|{} yawns",
 	    "description_second": "{} casts a sleeping spell on {}",

+ 4 - 0
events.py

@@ -656,6 +656,10 @@ def spawnNPC(etarget, ebody, players, npcs, items, env, npcsDB, envDB):
                                    'fightingStyle': npcsDB[int(body[0])]['fightingStyle'],
                                    'restRequired': npcsDB[int(body[0])]['restRequired'],
                                    'enemy': npcsDB[int(body[0])]['enemy'],
+                                   'tempCharm': npcsDB[int(body[0])]['tempCharm'],
+                                   'tempCharmTarget': npcsDB[int(body[0])]['tempCharmTarget'],
+                                   'tempCharmDuration': npcsDB[int(body[0])]['tempCharmDuration'],
+                                   'tempCharmStart': npcsDB[int(body[0])]['tempCharmStart'],
                                    'guild': npcsDB[int(body[0])]['guild'],
                                    'guildRole': npcsDB[int(body[0])]['guildRole'],
                                    'archetype': npcsDB[int(body[0])]['archetype'],

+ 1 - 1
functions.py

@@ -458,7 +458,7 @@ def saveState(player, masterDB, savePassword):
     #masterDB = loadPlayersDB()
 
 
-def saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env):
+def saveUniverse(rooms, npcsDB, npcs, itemsDB, items, envDB, env, guildsDB):
     # save rooms
     with open("universe.json", 'w') as fp:
         commentjson.dump(rooms, fp, indent=4, sort_keys=True)

+ 4 - 0
playerconnections.py

@@ -106,6 +106,10 @@ def runNewPlayerConnections(mud, id, players, playersDB, fights, Config):
             'fightingStyle': None,
             'restRequired': None,
             'enemy': None,
+            'tempCharm': None,
+            'tempCharmTarget': None,
+            'tempCharmDuration': None,
+            'tempCharmStart': None,
             'guild': None,
             'guildRole': None,
             'archetype': None,

File diff suppressed because it is too large
+ 1 - 1
players/Guest.player


+ 4 - 0
players/player.template

@@ -64,6 +64,10 @@
     "fightingStyle": "",
     "restRequired": 0,
     "enemy": "",
+    "tempCharm": 0,
+    "tempCharmTarget": "",
+    "tempCharmDuration": 0,
+    "tempCharmStart": 0,
     "guild": "",
     "guildRole": "",
     "archetype": "",