hxp
2021-11-09 f4f907ae6ae2f22207859230e8fc88583fe3a723
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.Friend
#
# @todo:ºÃÓÑ
# @author hxp
# @date 2021-11-09
# @version 1.0
#
# ÏêϸÃèÊö: ºÃÓÑ
#
#-------------------------------------------------------------------------------
#"""Version = 2021-11-09 20:00"""
#-------------------------------------------------------------------------------
 
import GameWorld
import PyDataManager
 
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
#---------------------------------------------------------------------
 
#---------------------------------------------------------------------
#Âß¼­ÊµÏÖ
## Ö´ÐÐÂß¼­
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param gmList [cmdIndex gmAccID msg]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, gmList):
    ## ±¾·þ´¦Àí
    
    if not gmList or len(gmList) != 2:
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÇ×ÃÜ: Friend ºÃÓÑÍæ¼ÒID Ç×ÃܶÈ")
        curFriends = PyDataManager.GetFriendManager().GetFriends(curPlayer.GetPlayerID())
        if curFriends:
            GameWorld.DebugAnswer(curPlayer, "µ±Ç°ºÃÓÑ×ÜÊý=%s" % len(curFriends.SocialDict))
            for friendID, friendObj in curFriends.SocialDict.items():
                GameWorld.DebugAnswer(curPlayer, "    friendID=%s,Ç×ÃܶÈ=%s" % (friendID, friendObj.Intimacy))
        return
    
    friendID = gmList[0]
    intimacyValue = gmList[1]
    playerID = curPlayer.GetPlayerID()
    
    curFriends = PyDataManager.GetFriendManager().GetFriends(playerID)
    if not curFriends:
        GameWorld.DebugAnswer(curPlayer, "ûÓкÃÓÑ£¡")
        return
    
    updIntimacy = curFriends.SetIntimacy(curPlayer, friendID, intimacyValue)
    if updIntimacy == None:
        GameWorld.DebugAnswer(curPlayer, "ûÓиúÃÓÑ£¡friendID=%s" % friendID)
        return
        
    GameWorld.DebugAnswer(curPlayer, "ÉèÖúÃÓÑ[ %s ]Ç×ÃܶÈ: %s" % (friendID, updIntimacy))
    
    tagFriends = PyDataManager.GetFriendManager().GetFriends(friendID)
    if tagFriends != None:
        tagPlayer = GameWorld.GetPlayerManager().FindPlayerByID(friendID)
        updIntimacy = tagFriends.SetIntimacy(tagPlayer, playerID, intimacyValue)
        if updIntimacy != None:
            GameWorld.DebugAnswer(curPlayer, "¶Ô·½ºÃÓÑ[ %s ]Ç×ÃܶÈ: %s" % (playerID, updIntimacy))
            
    return